Hashing & KDF
@webbuf/pbkdf2-sha256
Rust/wasm optimized PBKDF2-HMAC-SHA256 password-based key derivation
Install
npm install @webbuf/pbkdf2-sha256 Usage
import { pbkdf2Sha256 } from "@webbuf/pbkdf2-sha256";
import { WebBuf } from "@webbuf/webbuf";
const password = WebBuf.fromUtf8("my password");
const salt = WebBuf.fromUtf8("random salt");
const iterations = 100_000;
const keyLen = 32;
const derivedKey = pbkdf2Sha256(password, salt, iterations, keyLen); // FixedBuf<32>
console.log(derivedKey.toHex()); API reference (1 export)
Functions
pbkdf2Sha256
functionpbkdf2Sha256<N extends number>(password: WebBuf, salt: WebBuf, iterations: number, keyLen: N): FixedBuf<N>