def testStreamEncryptor(self): crypt = EncryptStream(self.password) c = self.bigdata mid = len(c)//2 crypt.write(c[:mid]) crypt.write(c[mid:]) crypt.close() enc = crypt.read() dec = decrypt_string(self.password, enc) self.assertEqual(c, dec)
def testPadding(self): for i in xrange(1, 64): data = os.urandom(i) enc = encrypt_string(self.password, data) dec = decrypt_string(self.password, enc) self.assertEqual(data, dec)
def testPasswords(self): for i in xrange(1, 32): password = os.urandom(i) enc = encrypt_string(password, self.bigdata) dec = decrypt_string(password, enc) self.assertEqual(self.bigdata, dec)
def testCrypt(self): enc = encrypt_string(self.password, self.bigdata) dec = decrypt_string(self.password, enc) self.assertEqual(self.bigdata, dec)