@quip.network/hashsigs
Version:
Hash-based signatures, WOTS+
35 lines (33 loc) • 1.3 kB
TypeScript
interface HashFunction {
(data: Uint8Array): Uint8Array;
}
declare class WOTSPlus {
private readonly hashFn;
readonly hashLen: number;
readonly messageLen: number;
readonly chainLen: number;
readonly lgChainLen: number;
readonly numMessageChunks: number;
readonly numChecksumChunks: number;
readonly numSignatureChunks: number;
readonly signatureSize: number;
readonly publicKeySize: number;
constructor(hashFunction: HashFunction, hashLen?: number, chainLen?: number);
private validateParameters;
private hash;
private prf;
generateRandomizationElements(publicSeed: Uint8Array): Uint8Array[];
private chain;
private xor;
generateKeyPair(privateSeed: Uint8Array, publicSeed: Uint8Array): {
publicKey: Uint8Array;
privateKey: Uint8Array;
};
sign(privateKey: Uint8Array, publicSeed: Uint8Array, message: Uint8Array): Uint8Array[];
verify(publicKey: Uint8Array, message: Uint8Array, signature: Uint8Array[]): boolean;
verifyWithRandomizationElements(publicKeyHash: Uint8Array, message: Uint8Array, signature: Uint8Array[], randomizationElements: Uint8Array[]): boolean;
private toBaseW;
private checksum;
private computeMessageHashChainIndexes;
}
export { type HashFunction, WOTSPlus };