欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

openssl rand 产生随机数

openssl rand 产生随机数

2012年09月17日 16:06:48 fym0121 阅读数:16164 标签: randomhexfile 更多                    
个人分类: tools                    

<openssl rand> <fym0121@163.com>
               

介绍

openssl rand 用于产生指定长度个bytes的随机字符。

语法


               

openssl rand[-out file] [-randfile(s)] [-base64] [-hex]num                

  1. E:\OpenSSL\foo>openssl rand 10                            
  2. 騆oading 'screen' into random state - done
  3. t嬍鴢vA
可以看见,这10个字节的随机数显示为乱码,可以用 -out 将随机字符放到一个文件中

-base64 / -hex   对随机字符串进行base64编码或用hex格式显示


               

  1. E:\OpenSSL\foo>openssl rand -hex 10                            
  2. Loading 'screen' into random state - done
  3. 325567f39cb3dbf15a32
                               
  1. E:\OpenSSL\foo>openssl rand -base64 20                            
  2. Loading 'screen' into random state - done
  3. aA58hKadrquIX1Jfr4COCm9m/NE=



               

来自  https://blog.csdn.net/fym0121/article/details/7988071


           

           
   
           

openssl rand

2018年04月25日 09:16:40 艾-小小雨 阅读数:108            

 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/aixiaoxiaoyu/article/details/80074149
用途:                
生成随机数
语法:                
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 30;                
openssl rand -hex 30;                
openssl rand 30                

 

openssl系列命令大纲:http://www.cnblogs.com/aixiaoxiaoyu/p/8650180.html                

来自  https://blog.csdn.net/aixiaoxiaoyu/article/details/80074149

普通分类: