UNPKG

976 BTypeScriptView Raw
1/// <reference types="node" />
2
3declare namespace createHash {
4 type TypedArray =
5 | Uint8Array
6 | Uint8ClampedArray
7 | Uint16Array
8 | Uint32Array
9 | Int8Array
10 | Int16Array
11 | Int32Array
12 | Float32Array
13 | 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;