2 ms·
I see that Google allows you to use the crypt module, and I would wager that their Python is linked against glibc, in which case, you might be able to use sha-c
by js2 16y ago
I see that Google allows you to use the crypt module, and I would wager that their Python is linked against glibc, in which case, you might be able to use sha-crypt. It's worth checking. e.g.:
def encode_password(password):
"""Return crypt() encoded password"""
# Uses glibc SHA-crypt extension via $6$
salt = b64encode(os.urandom(8)).rstrip('=')
return crypt(password, '$6$' + salt)