最佳答案:1. 这种方法使用SHA算法来加密日期,并输出结果的前32个字符:date +%s | sha256sum | base64 | head -c 32 ; echo2.这种方法使用内嵌的/dev/ur
1. 这种方法使用SHA算法来加密日期,并输出结果的前32个字符:
date +%s | sha256sum | base64 | head -c 32 ; echo
2.这种方法使用内嵌的/dev/urandom,并过滤掉那些日常不怎么使用的字符。这里也只输出结果的前32个字符:
</dev/urandom tr-dc _A-Z-a-z-0-9|head-c${1:-32};echo;
3.这种方法使用openssl的随机函数。如果你的系统也许没有安装openssl,你可以尝试其它九种方法或自己安装openssl。
openssl rand-base6432
4.这种方法类似于之前的urandom,但它是反向工作的。Bash的功能是非常强大的!
tr-cd'[:alnum:]'</dev/urandom|fold-w30|head-n1
5.这种方法使用string命令,它从一个文件中输出可打印的字符串:
strings/dev/urandom|grep-o'[[:alnum:]]'|head-n30|tr-d'\n';echo