Last Updated:

命令行生成随机密码

Konvict
  1. sha256sum
date +%s | sha256sum | base64 | head -c 32  ; echo
  1. /dev/urandom
<  /dev/urandom tr -dc _A-Z-a-z-0-9  | head -c${1:-32};echo;
#或
tr -cd '[:alnum:]'  <  /dev/urandom | fold -w30 | head -n1
#或
<  /dev/urandom tr -dc _A-Z-a-z-0-9  | head -c6
#或
</dev/urandom tr -dc '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB'  | head -c8; echo ""
  1. openssl
openssl rand -base64 32
  1. dd
dd if=/dev/urandom bs=1 count=32  2>/dev/null | base64 -w 0  | rev | cut -b 2-  | rev
  1. string
strings /dev/urandom | grep -o '[[:alnum:]]'  | head -n 30  | tr -d 'n'; echo
  1. date+md5sum
date | md5sum