Password hash

Ian Kelly ian.g.kelly at
Wed Dec 26 21:16:41 CET 2012

On Tue, Dec 25, 2012 at 8:40 PM, Ramchandra Apte <maniandram01 at> wrote:
> On Monday, 24 December 2012 08:08:12 UTC+5:30, Robert Montgomery  wrote:
>> I am writing a script that will send an email using an account I set up
>> in gmail. It is an smtp server using tls on port 587, and I would like
>> to use a password hash in the (python) script for login rather than
>> plain text. Is this do-able? Details please.
> No. The password is encrypted with TLS I think so I believe you shouldn't worry much about security.

The smtplib module automatically uses CRAM-MD5 for authentication if
it is available.  If you wanted to use some other hashing scheme then
I guess you would have to implement it yourself by overriding
SMTP.login, or find another SMTP module that already supports it.

The above comment about security is bad advice.  Security is all about
layers.  Just because the data stream is already encrypted (read:
decryptable) does not mean that password digests are a waste of time.
In fact, the two techniques are usually considered complementary:  the
encryption process protects your application data, while the password
hashing protects your authentication details.

More information about the Python-list mailing list