Example #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)
Example #2
0
def sencrypt(passphrase, filepath):
    plaintext = readFile(filepath)
    ciphertext = crypto.sencrypt(passphrase, plaintext)
    print(ciphertext)
    writeFile(filepath + ".locked", ciphertext, bytestring=True)