def func(file_reference):
    ...
```
Additionally, you can hash FileReference objects by the file's contents:
```python
class FileReference:
    def init(self, filename):
        self.filename = filename
def hash_file_reference(file_reference):
    with open(file_reference.filename) as f:
      return f.read()
@st.cache(hash_funcs={FileReference: hash_file_reference})
def func(file_reference):
    ...
```
Because Streamlit's hash function works recursively, you don't have to hash the contents inside hash_file_reference Instead, you can return a primitive type, in this case the contents of the file, and Streamlit's internal hasher will compute the actual hash from it.
Typical hash functions
While it's possible to write custom hash functions, let's take a look at some of the tools that Python provides out of the box. Here's a list of some hash functions and when it makes sense to use them.
