AES,Blowfish和PBE的加密/解密时间 [英] Encryption/ Decryption time of AES, Blowfish, and PBE

查看:269
本文介绍了AES,Blowfish和PBE的加密/解密时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个应用程序来加密/解密文件。用户可以从3种不同的算法中选择,即AES或Blowfish或PBE。然后将显示加密,解密和总时间。我试图比较3 algos w.r.t的效率时间的元素。我的大学教授告诉我研究这3种算法的时间复杂度。除了计算时间复杂度之外,还有什么其他方法来确定算法效率w.r.t速度?有什么特别的资源,我可以开始学习和实现我的目标吗?我的目标是得出一个结论,为什么一个特定类型的算法的工作速度比另一个特定的文件格式(例如aes可能比mp3文件更快的pdf文件)

I've developed an application to encrypt / decrypt a file. The user can choose from 3 different algorithms i.e. AES or Blowfish or PBE. And then the encryption, decryption and total time would be displayed. I'm trying to compare the efficiency of the 3 algos w.r.t the element of "time". My professor at college has told me to study the time complexity of these 3 algorithms. What are the other ways to determine algorithm efficiency w.r.t speed in addition to calculating the time complexity? Is there any particular resource from which I can start learning and achieve my objective? My objective is to come to a conclusion, WHY a particular type of algorithm works faster than another for a particular file format(for example aes may be faster when it comes to pdf files than mp3 files)

[我的朋友建议我在各种处理器上运行应用程序,并尝试确定处理器类型和应用程序性能之间是否存在任何关系。他是正确的吗? ]
- 谢谢。

[A friend of mine suggested me to run the application on various processors and try to determine if there exists any relationship between the type of processor and the application performance. Is he correct? ] -- Thanks.

推荐答案

正如其他人已经指出的,加密算法的时间复杂度总是线性的输入大小。它显然不能更快,超线性复杂性是不切实际的。我也不知道一个密码的速度取决于输入的类型。它不应该有什么区别,无论你加密,比方说,一个10 MB的PDF文件或一个10 MB的MP3。

As others have already noted, the time complexity of encryption algorithms is always linear in the input size. It obviously can't be faster and superlinear complexity would be unpractical. I also don't know of a cipher whose speed depends on the type of input. It should never make a difference whether you encrypt, say, a 10 MB PDF file or a 10 MB MP3.

所以速度差异只能归结到一个具体密码的实现是在具体的硬件架构上。流行的OpenSSL库具有内置的基准测试工具,显示其特定实现的速度。下面是运行32位Ubuntu(PBE不是密码)的Intel Atom处理器上比较AES-256和Blowfish的示例:

So the speed differences only boil down to how fast a concrete implementation of a cipher is on a concrete hardware architecture. The popular OpenSSL library has a built-in benchmarking tool that shows how fast their particular implementations are. Here's an example run comparing AES-256 and Blowfish on an Intel Atom processor running 32-bit Ubuntu (PBE isn't a cipher):

$ openssl speed aes-256-cbc bf-cbc
Doing aes-256 cbc for 3s on 16 size blocks: 2156930 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 64 size blocks: 563323 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 256 size blocks: 142873 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 1024 size blocks: 35857 aes-256 cbc's in 3.00s
Doing aes-256 cbc for 3s on 8192 size blocks: 4487 aes-256 cbc's in 3.00s
Doing blowfish cbc for 3s on 16 size blocks: 10063235 blowfish cbc's in 3.00s
Doing blowfish cbc for 3s on 64 size blocks: 2759400 blowfish cbc's in 3.00s
Doing blowfish cbc for 3s on 256 size blocks: 705523 blowfish cbc's in 3.00s
Doing blowfish cbc for 3s on 1024 size blocks: 177777 blowfish cbc's in 3.00s
Doing blowfish cbc for 3s on 8192 size blocks: 22266 blowfish cbc's in 3.00s
OpenSSL 1.0.1c 10 May 2012
built on: Tue Mar 19 19:10:21 UTC 2013
options:bn(64,32) rc4(8x,mmx) des(ptr,risc1,16,long) aes(partial) blowfish(idx)
compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DOPENSSL_NO_TLS1_2_CLIENT -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
blowfish cbc     53670.59k    58867.20k    60204.63k    60681.22k    60801.02k
aes-256 cbc      11503.63k    12017.56k    12191.83k    12239.19k    12252.50k

你可以看到,Blowfish比使用特定实现的特定机器上的AES-256快得多。但是这只是一个数据点。

You can see that Blowfish is considerably faster than AES-256 on that particular machine using that particular implementation. But that's only a single data point.

为了回答为什么一个密码比另一个更快,你必须研究算法的细节和性能特征不同的硬件平台。还要注意,最快的实现通常用汇编语言编写,以最大程度地提高性能。

To answer the question of why one cipher is faster than another, you have to study the details of the algorithm and the performance characteristics of different hardware platforms. Also note that the fastest implementations are often written in assembly language to eke out maximum performance.

这篇关于AES,Blowfish和PBE的加密/解密时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆