def testEncryptionDecryptionEqual(self): """ Test that a message is equal to the result of it being encrypted and then decrypted """ key = bytes("arbitrary_key", "utf-8") message = bytes("hello world", "utf-8") ciphertext = encrypt(message, 20, key) decrypted = decrypt(ciphertext, 20, key) self.assertEqual(message, decrypted)
def testEncryptionDecryptionLengthEqual(self): """ The message prior to and after encryption/decryption is the same length """ key = bytes("arbitrary_key", "utf-8") message = bytes("hello world", "utf-8") keystream = rc4(80, 100, key) ciphertext = encrypt(message, 20, keystream) plaintext = decrypt(ciphertext, 20, keystream) self.assertEqual(len(message), len(plaintext))