DefinitelyTyped/types/blake2/blake2-tests.ts
antoine beauᵛᵃᴵˢ⁻lacᵃˢˢᵉ 05e0a74be3 Add types for blake2 (#41178)
2019-12-27 09:06:40 -06:00

12 lines
384 B
TypeScript

import { createHash, createKeyedHash, Hash, KeyedHash } from 'blake2';
const fakeKey = Buffer.alloc(0);
const keyedHash: KeyedHash = createKeyedHash('blake2b', fakeKey);
keyedHash.update(Buffer.alloc(0)).digest();
const regularHash: Hash = createHash('blake2s', { digestLength: 256 });
const regularHashViaCtor: Hash = new Hash('blake2bp');
const copy: Hash = regularHash.copy();