UNPKG

merkle-tree-lib

Version:

Merkle Tree implementation with BIP340 tagged hash support.

41 lines (40 loc) 1.15 kB
import { HashStrategy } from '../HashStrategy'; /** * TaggedSha256Strategy - Implementation of HashStrategy using BIP-0340 tagged SHA-256 * This implements tagged hashing as defined in BIP-0340: SHA256(SHA256(tag) || SHA256(tag) || msg) */ export declare class TaggedSha256Strategy implements HashStrategy { private readonly tag; private readonly tagHash; /** * Initialize with a specific tag * * @param tag - Tag string to use for domain separation */ constructor(tag: string); /** * Calculate a tagged SHA-256 hash for the input data * * @param data - The data to hash * @returns The computed tagged SHA-256 hash as a Buffer */ hash(data: Buffer | string): Buffer; /** * Get the algorithm name including the tag * * @returns A descriptive string with the algorithm and tag */ getAlgorithmName(): string; /** * Get the tag used for this strategy * * @returns The tag string */ getTag(): string; /** * Get the pre-computed tag hash * * @returns The tag hash as a Buffer */ getTagHash(): Buffer; }