3.openssl speed和openssl rand
openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html
1.1 openssl speed
测试加密算法的性能。
支持的算法有:
openssl speed [md2] [mdc2] [md5] [hmac] [sha1] [rmd160] [idea-cbc] [rc2-cbc] [rc5-cbc] [bf-cbc] [des-cbc] [des-ede3] [rc4] [rsa512] [rsa1024] [rsa2048] [rsa4096] [dsa512] [dsa1024] [dsa2048] [idea] [rc2] [des] [rsa] [blowfish]
不过为什么没有base64算法呢?
测试速度好几秒一个指标,很慢。如果不指定参数将测试所有支持的算法,所以会花很久时间,我的虚拟机上花了十多分钟才测试完所有的算法性能。
例如测试下,dsa512、rsa512和rsa2048加密速度如何。
[root@xuexi tmp]# openssl speed dsa512 rsa512 rsa2048
Doing bit private rsa's for 10s: 107496 512 bit private RSA's in .99s
Doing bit public rsa's for 10s: 1425095 512 bit public RSA's in .00s
Doing bit private rsa's for 10s: 4623 2048 bit private RSA's in .99s
Doing bit public rsa's for 10s: 153395 2048 bit public RSA's in .99s
Doing bit sign dsa's for 10s: 102089 512 bit DSA signs in 10.00s
Doing bit verify dsa's for 10s: 121654 512 bit DSA verify in 9.99s
sign verify sign/s verify/s
rsa bits .000093s .000007s 10760.4 142509.5
rsa bits .002161s .000065s 462.8 15354.9
sign verify sign/s verify/s
dsa bits .000098s .000082s 10208.9 12177.6
在10秒时间内,rsa512的私钥处理107496单位,而rsa2048仅处理4623单位,慢了20多倍。
再看签名性能,dsa算法只支持签名不支持加密,而rsa支持加密也支持签名。从上面的结果中可以看到rsa512的签名速度为每秒10760.4,而dsa512的速度为10208.9,速度相差不大。
1.2 openssl rand
生成伪随机数。
openssl rand [-out file] [-rand file(s)] [-base64] [-hex] num
选项说明:
-out:指定随机数输出文件,否则输出到标准输出。
-rand file:指定随机数种子文件。种子文件中的字符越随机,openssl rand生成随机数的速度越快,随机度越高。
-base64:指定生成的随机数的编码格式为base64。
-hex:指定生成的随机数的编码格式为hex。
num:指定随机数的长度。
示例:
[root@xuexi tmp]# openssl rand -base64 ;openssl rand -hex ;openssl rand
7Nsce908GnQ5vpDH7Ww44f5ayZxCI0C9MzxSuaLj
af3efb867af2ffa7b9fd2ebd8caa977fc8d26f8a01de86d7b3de8630a25e
=@oxW[root@xuexi tmp]#
可以看到,不指定-base64或-hex时生成的随机数是乱码随机数(其实是2进制),且没有\n符号。
3.openssl speed和openssl rand的更多相关文章
- openssl speed和openssl rand
openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 1.1 openssl speed 测试加密算法的性能. 支持的算法有: o ...
- (5) openssl speed(测试算法性能)和openssl rand(生成随机数)
1.1 openssl speed 测试加密算法的性能 支持的算法有: openssl speed [md2] [mdc2] [md5] [hmac] [sha1] [rmd160] [idea-cb ...
- Openssl speed命令
一.简介 speed命令用于测试库的性能 二.语法 openssl speed [md2] [mdc2] [md5] [hmac] [sha1] [sha256] [sha512] [whirlpoo ...
- php开启openssl的方法,openssl安装
php开启openssl的方法,openssl安装 2014年10月10日 8312次浏览 什么是openssl? 关于openssl,我说的不如百度百科齐全,还是看看百度百科的解释吧!http:// ...
- OpenSSL主配置文件openssl.cnf
虽说配置文件很多设置不用修改就能直接使用,但是了解它是配置openssl相关事项所必须的.而且要实现复杂多功能,必然要对配置相关了然于心. 1.man config 该帮助文档说明了openssl.c ...
- (12) OpenSSL主配置文件openssl.cnf
1.man config 该帮助文档说明了openssl.cnf以及一些其他辅助配置文件的规范.格式及读取方式.后文中的所有解释除非特别指明,都将以openssl.cnf为例. [root@local ...
- 6.openssl rsautl和openssl pkeyutl
rsautl是rsa的工具,相当于rsa.dgst的部分功能集合.可用于签名.验证.加密和解密文件.非对称密钥的密钥是随机生成的,因此不需要也无法指定salt参与加密. pkeyutl是非对称加密的通 ...
- ambari2.6.50 openssl 版本问题:SSLError: Failed to connect. Please check openssl library versions. Openssl error upon host registration
I'm trying to register hostnames in Ambari but getting the error below. We tried to run yum update o ...
- 【openssl】利用openssl完成X509证书和PFX证书之间的互转
利用openssl完成X509证书和PFX证书之间的互转 # OpenSSL的下载与安装: 1.下载地址: 官方网址—— https://www.openssl.org/source/ OpenSSL ...
随机推荐
- JavaScript中__proto__与prototype的关系
一.所有构造器/函数的__proto__都指向Function.prototype,它是一个空函数(Empty function) 1 2 3 4 5 6 7 8 9 Number.__proto__ ...
- VMD_EI_API=>MAINTAIN_BAPI 去创建供应商主数据
转自 http://blog.sina.com.cn/s/blog_9ae2f2940102uxyp.html VMD_EI_API=>MAINTAIN_BAPI 去创建供应商主数据的部分数据代 ...
- 关于配置服务器(IIS7)
服务器Server2003 ,无限开机动画慢动作重播,一怒而重装server2008 然,重点就是系统装好了 IIS装好了 ,发布网站 开始各种错了!!! 1.第一个错 额,错误信息说 :由于权限不足 ...
- 虚拟机VMBox的空间扩展和对加载进来资源的扩展
来源于:http://www.linuxidc.com/Linux/2015-01/111186.htm 其中有点bug就自己重新复制黏贴下 VirtualBox虚拟机在使用的过程中,有时会遇到磁盘大 ...
- POJ-1743 Musical Theme(后缀数组)
题目大意:给一个整数序列,找出最长的连续变化相同的.至少出现两次并且不相重叠一个子序列. 题目分析:二分枚举长度进行判定. 代码如下: # include<iostream> # incl ...
- JavaScript中的document.cookie的使用
转:http://blog.csdn.net/liuyong0818/article/details/4807473 我们已经知道,在 document 对象中有一个 cookie 属性.但是 Coo ...
- ECShop函数列表大全
lib_time.php gmtime() P: 获得当前格林威治时间的时间戳 /$0 server_timezone() P: 获得服务器的时区 /$0 local_mktime(hour=NULL ...
- Knockoutjs实例 - 属性绑定(Bindings)之流程控制(Control flow)
一.foreach binding 使用此功能可以方便我们循环遍历输出某个数组.集合中的内容. (1).循环遍历输出数组 View Row Code 1 <script type="t ...
- iframe的高度自适应
http://www.cnblogs.com/snandy/p/3902337.html http://www.cnblogs.com/snandy/p/3900016.html Snandy Sto ...
- access数据库select查询top时无效的解决办法
access数据库select查询top时有时无效,原因就是在使用Order by时,且排序的条件中数据有重复的. 比如:select top 10 * from table1 order by cd ...