Skip to content

Instantly share code, notes, and snippets.

@sleepless-se
sleepless-se / hash.py
Created February 13, 2019 21:13 — forked from nmalkin/hash.py
SHA-256 hash of a string in Python 3
#!/usr/bin/env python3
import hashlib
def hash_string(string):
"""
Return a SHA-256 hash of the given string
"""
return hashlib.sha256(string.encode('utf-8')).hexdigest()