confingy.utils.hashing#
hashing
#
hash_class
#
hash_class(cls: type, algorithm: str = 'sha256') -> str
Create a hash of a class based on its bytecode. Only changes that affect code execution will change the hash.
The hash is deterministic across processes and is memoized per class, so mutating a class after it has been hashed will not update its hash.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cls
|
type
|
The class to hash |
required |
algorithm
|
str
|
The hashing algorithm to use (default: 'sha256') |
'sha256'
|
Returns:
| Type | Description |
|---|---|
str
|
Hexadecimal hash string |
Source code in src/confingy/utils/hashing.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |