import hashlib, base64


def get_hashing(string_repr, length=None):
    """Get the hashing of a string."""
    hashing = base64.b64encode(hashlib.md5(string_repr.encode('utf-8')).digest()).decode().replace("/", "a")[:-2]
    if length is not None:
        hashing = hashing[:length]
    return hashing