echo "A great password" | md5sum

Use md5 to generate a pretty hard to crack password

You can also use sha1sum and variants for longer passwords
Sample Output
280e25ade5d92394063ca7ae071d9f16

-5
2009-04-24 14:32:56

These Might Interest You

  • -B flag = don't include characters that can be confused for other characters (this helps when you give someone their password for the first time so they don't cause a lockout with, for example, denyhosts or fail2ban) -s flag = make a "secure", or hard-to-crack password -y flag = include special characters (not used in the example because so many people hate it -- however I recommend it) "1 10" = output 1 password, make it 10 characters in length For even more secure passwords please use the -y flag to include special characters like so: pwgen -Bsy 10 1 output>> }&^Y?.>7Wu Show Sample Output


    15
    pwgen -Bs 10 1
    linuxrawkstar · 2009-12-01 14:33:51 1
  • These are my favourite switches on pwgen: -B Don't include ambiguous characters in the password -n Include at least one number in the password -y Include at least one special symbol in the password -c Include at least one capital letter in the password It just works! Add a number to set password length, add another to set how many password to output. Example: pwgen -Bnyc 12 20 this will output 20 password of 12 chars length. Show Sample Output


    5
    pwgen -Bnyc
    KoRoVaMiLK · 2012-03-15 14:38:15 1
  • ZenCart uses a MD5 with a salt to secure its passwords. If you need to forcibly change someone's password to a known value within the database, this one-liner can generate the password. Change the value of 'p' to the password you want. Show Sample Output


    1
    python -c 'p="SeCuR3PwD";import hashlib as h;s=h.md5(p).hexdigest()[:2];pw=h.md5(s+p).hexdigest();print pw+":"+s;'
    Xiol · 2011-10-16 18:49:08 1
  • Permit to generate a password for userPassword in ldap. Use ?slappasswd -g? to generate a random passowrd. Show Sample Output


    -1
    slpappasswd
    evolix · 2011-10-13 14:46:03 0
  • generate password Show Sample Output


    1
    cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | sed 1q
    gnuyoga · 2009-12-01 09:09:56 2
  • usage: sitepass MaStErPaSsWoRd example.com description: An admittedly excessive amount of hashing, but this will give you a pretty secure password, It also eliminates repeated characters and deletes itself from your command history. tr '!-~' 'P-~!-O' # this bit is rot47, kinda like rot13 but more nerdy rev # this avoids the first few bytes of gzip payload, and the magic bytes. Show Sample Output


    14
    sitepass() { echo -n "$@" | md5sum | sha1sum | sha224sum | sha256sum | sha384sum | sha512sum | gzip - | strings -n 1 | tr -d "[:space:]" | tr -s '[:print:]' | tr '!-~' 'P-~!-O' | rev | cut -b 2-11; history -d $(($HISTCMD-1)); }
    syssyphus · 2009-10-01 20:14:57 5

What Others Think

1. 32 character length is too long for a password. If you ask md5sum to give you the password every time you need it, the security risk is too high. 2. It only has [0-9a-f], how can you think it is hard to crack?
jxy · 473 weeks and 5 days ago
jxy: While your first point is valid, your second one is not. A 32-character password using base-16 has: 16^32 password possibilities, which comes out to about 3.4 x 10^38. Let's say you use lower & uppercase letters, numbers, and a reasonable amount (20) different special characters. A password would have to be length 20 to match that order of magnitude. And 20 characters is also rather long.
dfego · 473 weeks and 5 days ago
jxy: I won't tell you're wrong about asking md5sum every time for a password, but at least is more secure than using "love". Also, since most cracking apps first try using a dictionary attack, this can improve just a little bit your security. I know there are many ways of getting a more secured password, but hey, this is just another way.
ubersoldat · 473 weeks and 5 days ago
Well, you could pipe the output of your command to base64 to get numbers and upper and lower letters. You could also pipe to cut to make it shorter (or just use the first n chars if you're just going to select it with your mouse). You'll also possibly get hyphen and slashes, which you could remove with tr -d if your particular application didn't like those chars. So, for example: echo "A great password"|md5sum|base64|tr -d /-|cut -c1-12 MjgwZTI1YWRl I just use the pwgen command (pwgen.sf.net).
splante · 371 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: