Skip to content

string-hashing/sha1

Repository files navigation

SHA1 bytestring hashing for JavaScript. See docs.

import {alloc} from '@array-like/alloc';
import * as ascii from '@codec-bytes/ascii';
import * as base16 from '@codec-bytes/base16';
import {sha1} from '@string-hashing/sha1';
const string = 'The quick brown fox jumps over the lazy dog';
const bytes = ascii.encode(string);
const digest = sha1(bytes, bytes.length * 8, alloc(20));
digest; // [0x2f, 0xd4, 0xe1, 0xc6, 0x7a, 0x2d, 0x28, 0xfc, 0xed, 0x84, ...]
base16.decode(digest); // '2FD4E1C67A2D28FCED849EE1BB76E7391B93EB12'

License Version Tests Dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size