''' Simple Function to generate a SHA256 hash of password. Password is first changed to Unicode. ''' def gen_pass_hash(password): try: string_to_hash = password hash_obj = hashlib.sha256(str(string_to_hash).encode('utf-8')) return True, hash_obj.hexdigest() except IndexError: return False, "Hashing Failure"