一直使用 /dev/urandom 和md5sum的方式去随机字符串,感觉还是不够随机,毕竟只有小写字母和数字嘛。

换换口味:

[root@localhost ~]# arr=(`echo {a..z} \# \@ \% \& {0..9} \! \; \? {A..Z} \> \+ \= `) ; str="" ; for i in `seq 18` ; do str=${str}${arr[`echo $RANDOM % ${#arr[*]} | bc`]}; done ; echo $str 
RtDYVei>WBx;U70Q+9

[root@localhost  ~]#  dd if=/dev/urandom bs=1 count=15 2> /dev/null | base64 -w 0 
Y5lDhOPq8eku8sya5peq

[root@localhost ~]# strings /dev/urandom |tr -dc A-Za-z0-9 | head -c20; echo
dDWq1Gv6VEg2uPSJ8Fly

相关文章:

  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
猜你喜欢
  • 2021-10-02
  • 2021-12-28
  • 2022-02-19
  • 2021-07-05
  • 2022-12-23
  • 2022-01-05
  • 2021-06-27
相关资源
相似解决方案