UNPKG

hash-wasm

Version:

Lightning fast hash functions for browsers and Node.js using hand-tuned WebAssembly binaries (MD4, MD5, SHA-1, SHA-2, SHA-3, Keccak, BLAKE2, BLAKE3, PBKDF2, Argon2, bcrypt, scrypt, Adler-32, CRC32, CRC32C, RIPEMD-160, HMAC, xxHash, SM3, Whirlpool)

38 lines (37 loc) 997 B
import type { IHasher } from "./WASMInterface"; import { type IDataType } from "./util"; export interface IPBKDF2Options { /** * Password (or message) to be hashed */ password: IDataType; /** * Salt (usually containing random bytes) */ salt: IDataType; /** * Number of iterations to perform */ iterations: number; /** * Output size in bytes */ hashLength: number; /** * Hash algorithm to use. It has to be the return value of a function like createSHA1() */ hashFunction: Promise<IHasher>; /** * Desired output type. Defaults to 'hex' */ outputType?: "hex" | "binary"; } interface IPBKDF2OptionsBinary { outputType: "binary"; } type PBKDF2ReturnType<T> = T extends IPBKDF2OptionsBinary ? Uint8Array : string; /** * Generates a new PBKDF2 hash for the supplied password */ export declare function pbkdf2<T extends IPBKDF2Options>(options: T): Promise<PBKDF2ReturnType<T>>; export {};