def decode(self, integer_list, key): decrypted_integer_list = [] for integer in integer_list: decrypted_integer_list.append(pow(integer, key[1], key[0])) decrypted_message = crypto_utils.text_from_blocks( decrypted_integer_list, 8) return decrypted_message
def decode(self, tekst, key): decoded_numbers = [] n = key[0] d = key[1] for num in tekst: decoded_numbers.append(pow(int(num),d,n)) return cu.text_from_blocks(decoded_numbers,8)
def decode(self, coded_text, key): decoded = '' blokker_decoded = [] for blokk in coded_text: blokker_decoded.append(pow(blokk, key[1], key[0])) decoded = text_from_blocks(blokker_decoded, 4) return decoded
def decode(self, text, cipher_key): """Decode blocks and use text_from_blocks to fuse them together""" decoded_blocks = [] for block in text: decoded_blocks.append(self.decode_int(block, cipher_key)) return text_from_blocks(decoded_blocks, self._block_length * self._byte_size)
def decode(self, key, message): """metode for å dekode en melding""" decoded = [] for number in message: decoded_number = pow(number, key[1], key[0]) decoded.append(decoded_number) return crypto_utils.text_from_blocks(decoded, 2)
def decode(self, blocks, secret_key): """ Decode the encoded message with the decryption key """ decoded_numbers = [] sum_primes = secret_key[0] inverse_rand_num = secret_key[1] for number in blocks: decoded_number = pow(number, inverse_rand_num, sum_primes) decoded_numbers.append(decoded_number) decoded_message = text_from_blocks(decoded_numbers, 8) return decoded_message
def decode(self, encoded_text, key): """ Decode message using private key :param encoded_text: encoded list of integers "c"s :param key: private key (n,d) used to decrypt :return: decrypted message """ n, d = key decrypted_integers = [] for c_encrypted in encoded_text: t_prime = pow(c_encrypted, d, n) decrypted_integers.append(t_prime) binary_message = text_from_blocks(decrypted_integers, self.__bits__) decrypted_message = [ binary_message[i:i + 8] for i in range(0, len(binary_message), 8) ] decrypted_message = "".join( [chr(int(x, 2)) for x in decrypted_message]) return decrypted_message
def decode(self, message, key): return crypto_utils.text_from_blocks(self.encode_decode(message, key), 8)
def decode(key, encoded_text): return crypto_utils.text_from_blocks([pow(c, key[1], key[0]) for c in encoded_text], 8)
def decode(self, text, key): decrypted_numbers = [] for number in text: decrypted_number = pow(number, key[1], key[0]) decrypted_numbers.append(decrypted_number) return crypto_utils.text_from_blocks(decrypted_numbers, 2)
def decode(self, code, key): """Dekrypterer RSA-koden""" block_list_decoded = [] for block in code: block_list_decoded.append(pow(block, key[1], key[0])) return crypto_utils.text_from_blocks(block_list_decoded, self.rsa_l)
def decode(self, text, key): decoded_blocks = [] for val in self.c_list: decoded_blocks.append( pow(val, self.decryption_key[1], self.decryption_key[0])) return crypto_utils.text_from_blocks(decoded_blocks, 2)
def decode(self, message, private_key): from crypto_utils import text_from_blocks n, d = private_key return text_from_blocks([pow(block, d, n) for block in message], 8)
def decode(self, text, key): n = key[0] d = key[1] dec_blocks = [pow(c, d, n) for c in text] return cu.text_from_blocks(dec_blocks, 1)
def decode(self, text, key): """key here is the receivers own private key, a tuple (n,d). 'text' is in this case a list of encrypted integers""" for i in range(len(text)): text[i] = pow(text[i], key[1], key[0]) return cu.text_from_blocks(text, 8)
def decode(self, cipher_text_blocks, key): new_blocks = [] for block in cipher_text_blocks: new_blocks.append(decode_integer(block, key)) return crypto_utils.text_from_blocks(new_blocks, 2)
def decode(block_text, private_key): for key, val in enumerate(block_text): block_text[key] = pow(val, private_key[1], private_key[0]) return text_from_blocks(block_text, 1024)
def decode(self, cypher_text, receivers_key): for t_element in cypher_text: t_element = (t_element * receivers_key[1]) % receivers_key[0] return text_from_blocks(cypher_text, 8)
def decode(self, text, key): n, d = key blocks = [pow(t, d, n) for t in text] decoded_text = text_from_blocks(blocks, 1) return decoded_text
def decode(self, encrypted): decypted_decimals = [pow(c, self.d_own, self.n_own) for c in encrypted] print(f'Decimals decrypted: {decypted_decimals}') return text_from_blocks(decypted_decimals, 8)
def decode(self, code, key): '''Decode''' decrypted_list = [pow(number, key[1], key[0]) for number in code] message = crypto_utils.text_from_blocks(decrypted_list, 8) return message