(algorithm, salt, raw_password)
Returns a string of the hexdigest of the given plaintext password and salt
  using the given algorithm ('bcrypt' or 'sha1').
Returns a string of the hexdigest of the given plaintext password and salt
  using the given algorithm ('bcrypt' or 'sha1').
Returns a string of the hexdigest of the given plaintext password and salt using the given algorithm ( bcrypt or sha1 ) .
def get_hexdigest(algorithm, salt, raw_password):
  """
  Returns a string of the hexdigest of the given plaintext password and salt
  using the given algorithm ('bcrypt' or 'sha1').
  """
  raw_password, salt = smart_str(raw_password), smart_str(salt)
  if algorithm == 'sha1':
    return hashlib.sha1(salt + raw_password).hexdigest()
  elif algorithm == 'bcrypt':
    import bcrypt
    return bcrypt.hashpw(raw_password, salt)
  raise Exception("Got unknown password algorithm type in password.")
def get_hexdigest ( algorithm , salt , raw_password ) : raw_password , salt = smart_str ( raw_password ) , smart_str ( salt ) if algorithm == 'sha1' : return hashlib . sha1 ( salt + raw_password ) . hexdigest ( ) elif algorithm == 'bcrypt' : import bcrypt return bcrypt . hashpw ( raw_password , salt ) raise Exception ( "Got unknown password algorithm type in password." )