Symmetric encryption algorithm and asymmetric encryption algorithm speed contrast _ information security

Source: Internet
Author: User
Tags decrypt asymmetric encryption

There are two articles worth looking at:
https://blog.csdn.net/wgw335363240/article/details/8878584

Conclusion:

1 AES encryption time and the size of the encrypted file is growing linearly, encrypting 1G of the file will take about 4 minutes, encryption speed is still very fast

2 The encrypted file size is twice times the size of the original file

3 The time required to decrypt the file is twice times the encryption time (this should be encrypted file is the original file size twice times the result)

https://blog.csdn.net/woshiaotian/article/details/46990899

Test environment:
CPU 1 Core Intel 2.2GHZ
Memory 1GB

Algorithm type
AES CBC mode based on symmetric encryption algorithm
Asymmetric Encryption Algorithm RSA 256

Encrypted plaintext length is 160 bytes
Run 10,000 times each

From Crypto.cipher import AES
import time
obj = aes.new (' A key123 ', AES. MODE_CBC, ' This is a IV456 '] message
= ' a ' * 160
T1 = time.time () to
I in Xrange (10000):
    ciphertext = OB J.encrypt (message)
    obj2 = Aes.new (' It is a key123 ', AES. MODE_CBC, ' is a IV456 ')
    text = Obj2.decrypt (ciphertext)
    #print text
t2 = time.time ()
print t2-t1
From Crypto.publickey import RSA
import time
t1 = time.time ()
key = Rsa.generate (2048)
t2 = Time.time () C4/>print ' Gen key ', t2-t1
#print key
#print key.exportkey ()
#print rsa.exportkey (' PEM ') message
= ' a ' * 160
T1 = time.time ()
for I-xrange (10000):
    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 algorithm is about 1500 times times faster than an asymmetric encryption algorithm
RSA to generate a key requires 0.68 seconds, visible symmetric encryption algorithm than asymmetric encryption algorithm has a very large performance advantage.

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.