Saturday, 13 March 2021

Fast way to generate random passwords in linux

 Command line:

date +%s%N | sha512sum | head -c12

In shell script:

PASSWORD=$(date +%s%N | sha512sum | head -c12)

Where:

date +%s%N - nanoseconds passed from the 00:00:00 UTC on 1 January 1970 

sha512sumThe sha512sum command displays or check SHA512 (512-bit) checksums.

head -c12 - take first 12 symbols 


No comments: