DigestUtils
JSON canonicalization and digest computation utilities.
Provides optimized implementations for JSON canonicalization and SHA-256 digest computation with multibase encoding (base58btc).
Performance Optimizations:
Cached JSON instances for reuse
Optimized canonicalization algorithm
Thread-safe digest computation
Properties
The current cache size. Useful for monitoring cache usage.
Whether digest caching is enabled. Set to false to disable caching (useful for memory-constrained environments).
Maximum number of entries in the digest cache. When this limit is reached, least recently used entries are evicted.
Functions
Canonicalizes a JSON string by parsing and re-serializing with stable key ordering.
Canonicalizes a JSON element by sorting keys lexicographically.
Clears the digest cache. Useful for memory management or testing.
Computes SHA-256 digest of a string with multibase encoding (base58btc).
Computes SHA-256 digest of a JSON element with multibase encoding (base58btc).