Differences between revisions 2 and 3
Revision 2 as of 2004-06-25 05:04:15
Size: 599
Editor: dsl254-010-130
Comment:
Revision 3 as of 2005-05-30 17:38:52
Size: 1068
Comment: Added salt
Deletions are marked like this. Additions are marked like this.
Line 28: Line 28:
  (none yet!) A good idea is to include a 'salt' with the hash as well, which will prevent people using a dictionary with
md5 hashes of common passwords. When you check a password, just add the salt to the front of the password and hash it.
The salt can be any random string.

Something like this:

{{{
#!python
import md5

key_string = "SecretPassword"
salt = "1Ha7"

hash = md5.new( salt + key_string ).hexdigest()
print "%s:%s" % (salt, hash) # Store these
}}}

AnthonyBriggs

MD5 Passwords

It's very easy to create MD5 passwords with Python-

You just:

   1 import md5
   2 
   3 key_string = raw_input( "Key to turn into an MD5 password? " )
   4 
   5 print md5.new( key_string ).hexdigest()

ex: "robots" turns into "27f5e15b6af3223f1176293cd015771d"

The "hexdigest" form is the form you frequently find used in databases and in online forums.

See Also

Discussion

A good idea is to include a 'salt' with the hash as well, which will prevent people using a dictionary with md5 hashes of common passwords. When you check a password, just add the salt to the front of the password and hash it. The salt can be any random string.

Something like this:

   1 import md5
   2 
   3 key_string = "SecretPassword"
   4 salt = "1Ha7"
   5 
   6 hash = md5.new( salt + key_string ).hexdigest()
   7 print "%s:%s" % (salt, hash) # Store these

AnthonyBriggs

Md5Passwords (last edited 2015-07-25 04:58:14 by RyanOHoro)

Unable to edit the page? See the FrontPage for instructions.