Generate a salt & hash

    If no string is provided then a random string will be
    used to hash & referred to as `val`.

    The salt will always be randomly generated & the hash
    will be a sha256 hex value of the `val` & the salt as
    a concatenated string. It follows the guidance here:

        crackstation.net/hashing-security.htm#properhashing

    :param val: str
    :return: tuple of strings (salt, hash)

def gen_salt_and_hash(val=None):
    """ Generate a salt & hash

    If no string is provided then a random string will be
    used to hash & referred to as `val`.

    The salt will always be randomly generated & the hash
    will be a sha256 hex value of the `val` & the salt as
    a concatenated string. It follows the guidance here:

        crackstation.net/hashing-security.htm#properhashing

    :param val: str
    :return: tuple of strings (salt, hash)
    """

    if not val:
        val = random_str()

    str_salt = random_str()
    str_hash = hashlib.sha256(val + str_salt).hexdigest()
    return str_salt, str_hash