ton_core package provides Python equivalents of the FunC stdlib hash functions cell_hash, slice_hash, and string_hash. Use them to reproduce on-chain hash computations off-chain, for example when signing or verifying data structured as cells.
cell_hash
Calculates the representation hash of the given cellc and returns it as a 256-bit unsigned integer x. This function is handy for signing and verifying signatures of arbitrary entities structured as a tree of cells.
slice_hash
Computes the hash of the given slices and returns it as a 256-bit unsigned integer x. The result is equivalent to creating a standard cell containing only the data and references from s and then computing its hash using cell_hash.
string_hash
Calculates the SHA-256 hash of the UTF-8 bytes of the given strings and returns it as a 256-bit unsigned integer x.