How to obscure a password

Peter Hansen peter at
Thu Feb 26 15:46:04 CET 2004

"Batista, Facundo" wrote:
> I'm doing a small program, in which the user will have the option to enter
> his/her password everytime, or just save it (to a file).
> So, is there a module to obscure the password text in a secure way?

No.  Absolutely not.

> I can't hash it (with md5 or something), because I not need to compare the
> password the user enters with a previous one.
> I need to restore the password later and use it as if the user just entered
> it.

Your design is probably fundamentally flawed in that case.  Are you 
certain it is not possible to store the hashed password and always
to compare against it?

The biggest concern I have with systems that allow retrieving the password,
even as an administrator, is that the users are generally not informed
that the administrator has full access to their passwords.  Since
many people re-use their favourite passwords all over the place, they
are prone to using the same password that gets them into their online
banking system as they use for the little web-based community site (or
whatever it is) that you're setting up.  

No matter how secure you make the front end (https, encrypting passwords 
in Javascript, etc) if you store the unencrypted password anywhere, you 
are doing your users a gross disservice.  Don't do it!  IMHO.


More information about the Python-list mailing list