content
content
#
value_hash — every value hashes by its structure, in one walk.
- Dispatch on the value (
_digest): a container hashes its kind and its children — a struct by field name, a map by encoded key, an array in order — and a leaf its contents — a file its extension and bytes, a directory its tree, a JSON scalar the bytes it stores as, aMissing(orNone, which stores as one) its reason, a plain value itscanonicalencoding. The class holding a value never enters, so a loaded value, an equal one built in memory and one from a re-executed module hash equal. - A read-only container remembers its hash, since it cannot change; an in-memory one is walked again each time, its read-only children answering from memory.
- A file or directory is hashed on every walk, since a workspace may write it in place, through the scratch's stat-checked cache; everything one walk learns is remembered in one write.
value_hash(value)
#
The content hash of value, by its structure; equal values hash equal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
A |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |