Skip to main content
The 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 cell c 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 slice s 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 string s and returns it as a 256-bit unsigned integer x.
These helpers are used by Get NFT Item Address to derive item indexes for TON DNS domains and Telemint tokens.