#### decrypted = cipher.decryptCBC(crypted) #### print "\tDecrypted:\t", decrypted ## ## print 'RC4\n' ## print '\t2 text\t\t',text ## crypted = encrypt(crypted, key) ## print '\t2 Encrypted text\t',(crypted) ## crypted = decrypt(crypted, key) ## print '\t2 Decrypted text\t',(crypted) ## ## cipher.initCBC() ## decrypted = cipher.decryptCBC(crypted) ## print "\t1 Decrypted:\t", decrypted import pavanclient pavanclient.send(crypted) ## print "Testing speed" ## from time import time ## t1 = time() ## n = 0 ## tlen = 0 ## while True: ## for i in xrange(1000): ## tstr = "The quick brown fox jumps over the lazy dog %d" % i ## enc = cipher.encryptCTR(tstr) ## tlen += len(tstr) ## n += 1000 ## t2 = time() ## if t2 - t1 > 5: ## break
print "Testing CBC encrypt:" cipher.initCBC() text = "Owen's Ornery Old Oryx Obstructed Olga's Optics." ## text = "The implementation passes algorithm test vectors (ECB)." print "\t1 Text:\t\t", text print '\t2 Decrypted text\t',(crypted) cipher.initCBC() decrypted = cipher.decryptCBC(crypted) print "\t1 Decrypted:\t", decrypted import pavanclient pavanclient.send("giidhar loves gokila") print "Testing speed" from time import time t1 = time() n = 0 tlen = 0 while True: for i in xrange(1000): tstr = "The quick brown fox jumps over the lazy dog %d" % i enc = cipher.encryptCTR(tstr) tlen += len(tstr) n += 1000 t2 = time() if t2 - t1 > 5: break
#### decrypted = cipher.decryptCBC(crypted) #### print "\tDecrypted:\t", decrypted ## ## print 'RC4\n' ## print '\t2 text\t\t',text ## crypted = encrypt(crypted, key) ## print '\t2 Encrypted text\t',(crypted) ## crypted = decrypt(crypted, key) ## print '\t2 Decrypted text\t',(crypted) ## ## cipher.initCBC() ## decrypted = cipher.decryptCBC(crypted) ## print "\t1 Decrypted:\t", decrypted import pavanclient pavanclient.send(d) ## print "Testing speed" ## from time import time ## t1 = time() ## n = 0 ## tlen = 0 ## while True: ## for i in xrange(1000): ## tstr = "The quick brown fox jumps over the lazy dog %d" % i ## enc = cipher.encryptCTR(tstr) ## tlen += len(tstr) ## n += 1000 ## t2 = time() ## if t2 - t1 > 5: ## break