UNPKG

1.37 kBTypeScriptView Raw
1// Type definitions for create-hash 1.2
2// Project: https://github.com/crypto-browserify/createHash
3// Definitions by: BendingBender <https://github.com/BendingBender>,
4// Konstantin Yuriev <https://github.com/gallowsmaker>,
5// Max Boguslavskiy <https://github.com/maxbogus>,
6// Jordan Sexton <https://github.com/jordansexton>
7// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8// TypeScript Version: 2.1
9
10/// <reference types="node" />
11
12declare namespace createHash {
13 type TypedArray = Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | Int8Array | Int16Array | Int32Array | Float32Array | Float64Array;
14
15 interface HashAlgorithm {
16 digest(target: encoding): string;
17 digest(): Buffer;
18
19 update(data: string | Buffer | TypedArray | DataView, encoding?: string): this;
20 write(data: string | Buffer | TypedArray | DataView, encoding?: string): this;
21
22 end(): void;
23 read(): void;
24 }
25
26 type encoding = 'utf8' | 'hex' | 'base64';
27 type algorithm =
28 | 'md5'
29 | 'rmd160'
30 | 'ripemd160'
31 | 'sha'
32 | 'sha1'
33 | 'sha224'
34 | 'sha256'
35 | 'sha384'
36 | 'sha512';
37}
38
39declare function createHash(algorithm: createHash.algorithm, options?: any): createHash.HashAlgorithm;
40
41export = createHash;