Skip to content

gimpelgit/streebog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Streebog Hash Algorithm

npm version License: MIT

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/streebog

Usage

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);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published