from typing import Union
import hashlib


def sha1(content: Union[str, bytes, bytearray, memoryview]) -> str:
    """
    sha1 encrypt

    :param content: words
    :return: encrypted codes
    """
    sha = hashlib.sha1()
    if isinstance(content, str):
        content = content.encode()
    sha.update(content)
    return sha.hexdigest()