예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 def testCrypt(self):
     enc = encrypt_string(self.password, self.bigdata)
     dec = decrypt_string(self.password, enc)
     self.assertEqual(self.bigdata, dec)