hashToIdentifier
hashToIdentifier(
digest,iDPrefix):string
Converts a digest to a unique identifier using a specified identifier prefix.
Parameters
Section titled “Parameters”• digest: any
The input digest to be encoded, which can be a hex string, Uint8Array, or a regular string.
• iDPrefix: number
The identifier prefix, a numerical value used to classify the type of data being encoded.
Returns
Section titled “Returns”string
A string representing the encoded identifier.
Example
Section titled “Example”const digest = '0x1234...'; // Hex string or Uint8Array or regular stringconst identifier = hashToIdentifier(digest, 29);console.log('Identifier:', identifier);Throws
Section titled “Throws”Assert error if the digest is invalid.