对称加密算法和非对称加密算法速度对比

版权声明 本站原创文章 由 萌叔 发表 转载请注明 萌叔 | http://vearne.cc 测试环境: CPU 1 核 Intel 2.2GHZ 内存 1GB 算法 种类 对称加密算法 AES CBC 模式 非对称加密算法 RSA 256 加密明文长度为160 bytes 各运行10000次 上代码 test_aes.py from Crypto.Cipher import AES import time obj = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') message = 'a' * 160 t1 = time.time() for i in xrange(10000): ciphertext = obj.encrypt(message) obj2 = AES.new('This is a key123', AES.MODE_CBC, 'This is an IV456') text = obj2.decrypt(ciphertext) #print text t2 = time.time() print t2 - t1 test_rsa.py ...

January 1, 2018 · 1 min