@gimpel/streebog
v0.0.1
Published
Streebog (GOST R 34.11-2018) cryptographic hash function with streaming support
Maintainers
Readme
Streebog Hash Algorithm
Implementation of the GOST R 34.11–2018 (Streebog) hashing algorithm in JavaScript. Supports generating 256-bit and 512-bit hash values.
Works in both Node.js and browsers.
Installation
npm install @gimpel/streebogUsage
Incremental hashing (streaming mode)
import { Streebog } from '@gimpel/streebog';
const hash512 = new Streebog(512)
.update('Hello, ')
.update('World!')
.digest('hex');
console.log(hash512); The hash is computed step-by-step as data is received, which allows processing large volumes of information without loading the entire content into memory.
Data passed to update() accumulates in an internal buffer. When the accumulated data reaches the block size — 512 bits (64 bytes) — the block is immediately processed by the algorithm. This way, the library doesn’t keep the entire input in memory.
One-line hash calculation
import { Streebog } from '@gimpel/streebog';
const hash256 = Streebog.hash('Hello, World!', 256, 'hex');
console.log(hash256);Getting the result as a Uint8Array
import { Streebog } from '@gimpel/streebog';
const bytes = Streebog.hash('Hello, World!', 512, 'buffer');
console.log(bytes);