2.0.0 • Published 1 year ago

@pallad/hash v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

CircleCI npm version Coverage Status

License: MIT

Simple crypto async hashing api with nice TextBufferView API

SHA

Supports sha256, sha384, sha512 algorithms.

import { ShaHasher } from '@pallad/hasher';


const hasher = new ShaHasher(256); // or 384, 512

const hash = await hasher.hash(
	TextBufferView.fromString('Hello, world!', 'utf8')
);

hash.toString('hex'); // 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3

Injectability

Since Hasher is an abstract class, you can make hasher injectable.

import {Hasher} from '@pallad/hasher';
class SomeService {
	constructor(private hasher: Hasher) {}
}