Hash of a code object

I’m looking for the exact way that a code object of a function may be hashed. For example, for this function f,
def f():
return 1
how exactly is hash(f.__code__), or equivalently f.__code__.__hash__(), implemented? This is important as I’m finding a way to hash a function based on its contents. Thank you!

For builtin python objects, this kind of information is findable by reading the source code.

From here you need to read the source code. There is no nice summary, the answer is “all fields are scrambled into the resulting hash”