def test_encryption(self): """ Tests that encryption and decryption are sane """ message = u"Hello, Nudge Encryption!" key = generate_key() encrypted, iv = encrypt(key.decode('hex'), message) decrypted = decrypt(key.decode('hex'), encrypted, iv) self.assertEqual(message, decrypted.strip())
def test_encryption(self): """ Tests that encryption and decryption are sane """ message=u"Hello, Nudge Encryption!" key=generate_key() encrypted, iv = encrypt(key.decode('hex'), message) decrypted= decrypt(key.decode('hex'), encrypted, iv) self.assertEqual(message, decrypted.strip())
def encrypt_batch(key, b_plaintext): """Encrypts a pickled batch for sending to server""" encrypted, iv = encrypt(key, b_plaintext) return {'batch': encrypted, 'iv': iv.encode('hex')}