Convert String to SHA1 in python



use this function:

import hashlib
def hashhex(s):    """Returns a heximal formated SHA1 hash of the input string."""    h = hashlib.sha1()    h.update(s.encode())    return h.hexdigest()