Skip to content

li0ard/streebog

Repository files navigation

@li0ard/streebog
Streebog hash function in pure TypeScript
docs




Warning

This library is currently in alpha stage: the lib is not very stable yet, and there may be a lot of bugs feel free to try it out, though, any feedback is appreciated!

Installation

# from NPM
npm i @li0ard/streebog

# from JSR
bunx jsr i @li0ard/streebog

Supported modes

  • Hash function
  • PBKDF2 (for 512 bit)
  • HMAC (256/512 bit)
  • KDF_GOSTR3411_2012_256 and KDF_TREE_GOSTR3411_2012_256

Features

  • Provides simple and modern API
  • Most of the APIs are strictly typed
  • Fully complies with GOST R 34.11-2012 (RFC 6986) standards
  • Supports Bun, Node.js, Deno, Browsers

Examples

Streebog 256 bit (aka GOST R 34.11-2012 256 bit)

import { streebog256 } from "@li0ard/streebog"

console.log(streebog256(new TextEncoder().encode("hello world")))

// OR

import { Streebog256 } from "@li0ard/streebog"

const hash = new Streebog256()
hash.update(new TextEncoder().encode("hello world"))
console.log(hash.digest())

Streebog 512 bit (aka GOST R 34.11-2012 512 bit)

import { streebog512 } from "@li0ard/streebog"

console.log(streebog512(new TextEncoder().encode("hello world")))

// OR

import { Streebog512 } from "@li0ard/streebog"

const hash = new Streebog512()
hash.update(new TextEncoder().encode("hello world"))
console.log(hash.digest())