UNPKG

771 BTypeScriptView Raw
1/// <reference types="node" />
2
3/**
4 * js function for hashing messages with SHA1
5 *
6 * @param message - a string or buffer to hash
7 * @param options - an options object
8 * @returns the resultant SHA1 hash of the given message
9 */
10declare function main(message: string | Buffer, options?: Sha1AsStringOptions): string;
11declare function main(message: string | Buffer, options?: Sha1AsBytesOptions): Uint8Array;
12declare function main(message: string | Buffer, options?: Sha1Options): string | Uint8Array;
13export = main;
14
15interface Sha1AsStringOptions {
16 asBytes?: false | undefined;
17 asString?: boolean | undefined;
18}
19
20interface Sha1AsBytesOptions {
21 asBytes: true;
22 asString?: false | undefined;
23}
24
25type Sha1Options = Sha1AsStringOptions | Sha1AsBytesOptions;