def hash_text(value, hasher=hashlib.sha256, encoding='<STR_LIT:utf-8>'):<EOL>
return hash_bytes(value.encode(encoding), hasher)<EOL>
Generate a hash for a text value.

The hash will be generated by encoding the text to bytes with given
encoding and then generating a hash with HMAC using the session
secret as the key and the given hash function.

:param value: Text value to hash
:param hasher: Hash function to use, SHA256 by default
:param encoding: Encoding to use, UTF-8 by default
:return: Hexadecimal presentation of the hash as a string