Skip to content

raw

const raw: <A>(rtType, value) => Uint8Array = persistentHash

Defined in: src/Hash.ts:166

Raw persistent hash function for advanced use cases.

This is a direct re-export of the underlying persistentHash function from @midnight-ntwrk/compact-runtime for users who need to hash custom Compact types not covered by the helper functions.

The Compact builtin persistent_hash function

This function is a non-circuit-optimised hash function for mostly arbitrary data. It is guaranteed to persist between upgrades, with the exception of devnet. It should be used to derive state data, and not for consistency checks where avoidable.

Note that data containing Opaque elements may throw runtime errors, and cannot be relied upon as a consistent representation.

Type Parameters

A

A

Parameters

rtType

CompactType<A>

value

A

Returns

Uint8Array

Throws

If rtType encodes a type containing Compact ‘Opaque’ types

Example

import { CompactTypeBytes } from '@midnight-ntwrk/compact-runtime';
const hash = Midday.Hash.raw(new CompactTypeBytes(64), myBytes64);

Since

0.3.0