import hashlib


def hash_string(text: str) -> bytes:
    """Calculate a hash of a string"""
    btext = bytes(text, "utf-8")
    h = hashlib.sha256()
    h.update(btext)
    d = h.digest()
    return d