UNPKG

1.12 kBTypeScriptView Raw
1// Type definitions for md5 2.3
2// Project: https://github.com/pvorb/node-md5
3// Definitions by: Bill Sourour <https://github.com/arcdev1>
4// Cameron Crothers <https://github.com/jprogrammer>
5// Piotr Błażejewicz <https://github.com/peterblazejewicz>
6// Ruslan Arkhipau <https://github.com/DethAriel>
7// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
8
9/**
10 * Calculate the MD5 hash of a message.
11 *
12 * @param message - Message to hash.
13 * @param options - Input and output options.
14 * @returns MD5 hash.
15 */
16declare function md5(message: string | number[] | Uint8Array, options: md5.Options & { asBytes: true }): number[];
17declare function md5(message: string | number[] | Uint8Array, options?: Pick<md5.Options, 'asString' | 'encoding'>): string;
18declare function md5(message: string | number[] | Uint8Array, options?: md5.Options): string | number[];
19
20declare namespace md5 {
21 interface Options {
22 asBytes?: boolean | undefined;
23 asString?: boolean | undefined;
24 encoding?: 'binary' | string | undefined;
25 }
26}
27
28export = md5;