make-github-pseudonymous-again / js-hash

:hocho: Hashing algorithms for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🔪 js-hash


© xkcd.com

Hashing algorithms for JavaScript.

import {alloc} from '@array-like/alloc';
import * as ascii from '@codec-bytes/ascii';
import * as base16 from '@codec-bytes/base16';
import {sha512} from '@string-hashing/sha2';
const string = 'The quick brown fox jumps over the lazy dog';
const bytes = ascii.encode(string);
const digest = sha512(bytes, bytes.length * 8, alloc(64));
digest; // [0x07, 0xe5, 0x47, 0xd9, 0x58, 0x6f, 0x6a, 0x73, 0xf7, 0x3f, ...]
base16.decode(digest); // '07E547D9586F6A73F73FBAC0435ED76951218FB7D0C8D788A309D785436B...'

🌳 Hierarchy

🍢 String hashing

About

:hocho: Hashing algorithms for JavaScript

License:GNU Affero General Public License v3.0