Last active
May 6, 2019 15:06
-
-
Save idleuncle/309aa50bd24c38404351579e846b0c83 to your computer and use it in GitHub Desktop.
随机生成密码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl rand -base64 8 | cut -c 1-9 | |
# 生成128位随机串 | |
cat /dev/urandom | od -X -N 16 | head -n 1 | cut -d ' ' -f 2- | tr -d ' ' | |
# 生成8字节长度随机串,27 = 9 + 16 | |
cat /dev/urandom | od -x | head -c 27 | cut -d ' ' -f 2- | tr -d ' ' | |
# 生成16字节长度随机串,41 = 9 + 32 | |
cat /dev/urandom | od -x | head -c 41 | cut -d ' ' -f 2- | tr -d ' ' | |
# 生成32字节长度随机串(最长32字节) | |
cat /dev/urandom | od -x | head -n 1 | cut -d ' ' -f 2- | tr -d ' ' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment