Symmetric encryption algorithm and asymmetric encryption algorithm speed comparison

Source: Internet
Author: User

test Environment:
CPU 1-Core Intel 2.2GHZ
Memory 1GB

algorithm type
Symmetric encryption algorithm AES CBC Mode
Asymmetric encryption algorithm RSA 256


Encrypted plaintext length is bytes
Run 10,000 times each

On the Code test_aes.py

 fromCrypto.cipher Import Aesimport Timeobj = AES.New(' This is a key123 'Aes. MODE_CBC,' This was an IV456 ') message =' A '* theT1 = Time. Time() forIinchXrange10000): ciphertext = obj.Encrypt(message) Obj2 = AES.New(' This is a key123 'Aes. MODE_CBC,' This was an IV456 ')text= Obj2.Decrypt(ciphertext)#print Textt2 = Time. Time() Print T2-t1

test_rsa.py

 fromCrypto.publickey Import Rsaimport TimeT1 = Time. Time() key = Rsa.generate (2048) T2 = Time. Time() Print' Gen key ', T2-T1#print Key#print Key.exportkey ()#print rsa.exportkey (' PEM ')Message =' A '* theT1 = Time. Time() forIinchXrange10000): print I ciphertext = key.Encrypt(Message, None) key.Decrypt(ciphertext) t2 = Time. Time() Print T2-t1
algorithm Time Consuming
Symmetric encryption algorithm 0.13
Asymmetric encryption algorithm 193.16
Asymmetric encryption algorithm generates key pair 0.68


Symmetric encryption algorithms are about 1500 times times faster than asymmetric encryption algorithms
RSA generates a key to take 0.68 seconds, visible symmetric encryption algorithm than asymmetric encryption algorithm has a very large performance advantage.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Symmetric encryption algorithm and asymmetric encryption algorithm speed comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.