[Tutor] Encrypting Passwords

Magnus Lyckå magnus@thinkware.se
Tue Jul 15 07:37:02 2003


At 21:38 2003-07-14 -0500, Mike Wagman wrote:
>Can anyone point me to a good module that handles encrypting password,
>ideally one that doesn't have any issues with py2exe, as my final
>product will me a stand alone exe.

 >>> import md5
 >>> seed = "42"
 >>> digest = md5.new(seed)
 >>> digest.update('My Password')
 >>> digest.hexdigest()
'22634f73ad7d03dbf826edc1e8fc68c6'

If md5 isn't secure enough for you:

 >>> import sha
 >>> digest = sha.new(seed)
 >>> digest.update('My Password')
 >>> digest.hexdigest()
'933257a3349a248d1e0fb19d7c953a00ff004a1d'

md5 and sha are built-in modules, I assume they will always work.



--
Magnus Lycka (It's really Lyckå), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language