|
Qelle: http://www.commandlinefu.com/commands/view/5504/produce-a-pseudo-random-password-with-given-length-in-base-64
Mit openssl
openssl rand -base64 <Länge> |head -c <länge>; echo
(Das echo sorgt nur für einen Zeilenumbruch bei der Ausgabe)
Beispiel:
$ openssl rand -base64 8 |head -c 8; echo
ipbn3Jxp
Mit date
date +%s | sha256sum | base64 | head -c <Länge>; echo
Beispiel
$ date +%s | sha256sum | base64 | head -c 8; echo
YTJiY2Ew
Mit perl
perl -MDigest::SHA -e 'print substr( Digest::SHA::sha256_base64( time() ), 0, $ARGV[0] ) . "\n"' <Länge>
Beispiel
$ perl -MDigest::SHA -e 'print substr( Digest::SHA::sha256_base64( time() ), 0, $ARGV[0] ) . "\n"' 8
NOowBgdn
Mit apg
apg -n 1 -m <Länge> -x <Länge>
Wenn man gerne Sonderzeichen haben möchte, muss man noch ein -a 1 hinzufügen.
Beispiel
$ apg -n 1 -m 8 -x 8
utipMosh
|