Generating your own password!
Remembering passwords might be crucial on your daily lives, specially these days almost everything needs password, I have this simple snippets to start generating your own code!
I'm using Ubuntu 12.10 for this commands.
Generating a Password
echo -n "mypassword" | md5sum
This will output:
34819d7beeabb9260a5c854bc85b3e44
Making it shorter
echo -n "mypassword" | md5sum | cut -c1-10
Shorter Output (10 characters):
34819d7bee
More Commands:
Saving it to a file:
echo -n "mypassword" | md5sum | cut -c1-10 > mypassword.txt
Appending timestamp + yourpasssword:
echo -n "mypassword$(date + %s)" | md5sum | cut -c1-10 > mypassword.txt
Emailing your new password:
echo -n "mypassword$(date + %s)" | md5sum | cut -c1-10 | mail -s "My New Password" yourmail@mail.com
Good Luck!
Written by Ricardo Pascua
Related protips
2 Responses
That seems pretty handy! However, you might want to be careful using MD5 to generate passwords. The first hash was broken by this website in about three seconds (probably because the input password was so weak). Something stronger might be better, like PBKDF2 or bcrypt.
Since you're appending the current timestamp to your password, I assume you just want to generate any old password. If that's the case, you can read pseudo-random data straight out of /dev/urandom. Pass that through something like Ascii85 to convert to printable-characters only.
With Ruby and the Ascii85
gem installed:
cat /dev/urandom | ruby -rubygems -rascii85 -e "puts Ascii85.encode(STDIN.read(12))[2...-2]"
echo `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c8`
or
openssl rand -base64 8