def _HashPassword(password, version, salt):
 if (version == _PASSWORD_VERSION_MD5):
  m = hashlib.md5()
  m.update(password)
  m.update(secrets.GetSecret('cookie_secret'))
  hashed = m.digest()
 elif (version == _PASSWORD_VERSION_PBKDF2):
  hashed = PBKDF2(password, base64.b64decode(salt), count=10000)
 return base64.b32encode(hashed)

def _HashPassword ( password , version , salt ) : if ( version == _PASSWORD_VERSION_MD5 ) : m = hashlib . md5 ( ) m . update ( password ) m . update ( secrets . GetSecret ( 'cookie_secret' ) ) hashed = m . digest ( ) elif ( version == _PASSWORD_VERSION_PBKDF2 ) : hashed = PBKDF2 ( password , base64 . b64decode ( salt ) , count = 10000 ) return base64 . b32encode ( hashed )
hashes the provided password according to the specified versions policy .