在终端使用 openssl 可以生成强类型的字符串密码。
下面是生成16位的(生成Base64随机数)
1
openssl rand -base64 16
结果:
1
HLKVF50Rlk5mGtdesju1HQ==
生成32位的
1
2
# openssl rand -base64 32
KSg/LHENxT7E4jLjYzurDFJ5h0NU7piUjZV3NPQvMlk=
生成十六进制随机数
1
2
# openssl rand -hex 20
616aafc9ca49a119c777e608f1c674d589733e5e