import hashlib


def get_sha_digest(s, strip=True):
    """Generate digest for s.

    Convert to byte string.
    Produce digest.

    """
    if strip:
        s = s.rstrip()
    s = s.encode("utf-8")
    return hashlib.sha256(s).hexdigest()