@pallad/hash
v2.0.0
Published
<div align="center"> <h1>Hasher 🌄</h1>
Downloads
4
Readme
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) {}
}