[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Generating Random Passwords with definable length
Hi
Today i had the "problem" that i wanted to create an AES256 Keyfile for
loop-aes. According to README a SHA512 Hash is used to generate the
encryption key.
Taking aside the fact halve the bits aren't really put to use here,
SHA512 still means 64 Byte of raw entropy.
The "standard" example only(tm) gives 45 bytes of entropy, so i thought
about how i can create random passwords with definable length, only
using standard unix tools.
So i stumbled over the "openssl" executable and it's many options. Which
i think sould be available on many systems.
With `openssl enc -base64 -A` you can create base64 encoded strings with
arbitrary length. So with a little loop around that you can create
key-files with arbitrary sized lines.
- snip -
for dat in `seq 1 65`; do head -c 90 /dev/random | openssl enc -base64 -A ; echo ; done | gpg --symmetric -a >/a/usbstick/keyfile.gpg
- snip -
90 bytes of entrophy or 120 chars per line in this example.
I think this is also a bit more elegant than the `head`ing and `tail`ing
in the README.
Bis denn
--
Real Programmers consider "what you see is what you get" to be just as
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated,
cryptic, powerful, unforgiving, dangerous.
-
Linux-crypto: cryptography in and on the Linux system
Archive: http://mail.nl.linux.org/linux-crypto/