Esempio n. 1
0
 def test_symmetric_encryption_loop(self):
     passphrase = 'Password!!!'
     plaintext = 'Hello World'
     ciphertext = crypto.sencrypt(passphrase, plaintext)
     deciphered = crypto.sdecrypt(passphrase, ciphertext)
     for i in range(0, 25):
         ciphertext = crypto.sencrypt(passphrase, deciphered)
         deciphered = crypto.sdecrypt(passphrase, ciphertext)
     self.assertEqual(plaintext, deciphered)
Esempio n. 2
0
def sdecrypt(passphrase, filepath):
    ciphertext = readFile(filepath, bytestring=True)
    plaintext = crypto.sdecrypt(passphrase, ciphertext)
    print(plaintext)
    writeFile(filepath + ".unlocked", plaintext)