def testStreamDecryptor(self): enc = encrypt_string(self.password, self.bigdata) crypt = DecryptStream(self.password) mid = len(enc)//2 crypt.write(enc[:mid]) crypt.write(enc[mid:]) crypt.close() dec = crypt.read() self.assertEqual(self.bigdata, dec)
def testStreamers(self): crypt = EncryptStream(self.password) clear = "" for dummy in xrange(64): data = os.urandom(1024) crypt.write(data) clear += data crypt.close() crypt2 = DecryptStream(self.password) crypt2.write(crypt.read()) crypt2.close() self.assertEqual(clear, crypt2.read())