UNPKG

@li0ard/streebog

Version:

Streebog hash function in pure TypeScript

12 lines (11 loc) 534 B
import { pbkdf2 } from "@noble/hashes/pbkdf2.js"; import { createHasher } from "@noble/hashes/utils.js"; import { Streebog512 } from "./index.js"; /** * PBKDF2 implementation for GOST R 34.11-2012 * @param password Password from which a derived key is generated * @param salt Salt * @param iterations Number of iterations (aka work factor) * @param dkLen Output length */ export const Streebog512PBKDF2 = (password, salt, iterations, dkLen) => pbkdf2(createHasher(Streebog512.create), password, salt, { dkLen, c: iterations });