-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
index.d.ts
89 lines (75 loc) · 2.04 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
export type OptionsHexOutput = {
outputFormat?: 'hex';
};
export type OptionBufferOutput = {
outputFormat: 'buffer';
};
/**
[SHA-1 is insecure](https://stackoverflow.com/a/38045085/64949) and should not be used for anything sensitive.
@returns The Hex-encoded hash.
@example
```
import {sha1} from 'crypto-hash';
console.log(await sha1('🦄'));
//=> '5df82936cbf0864be4b7ba801bee392457fde9e4'
```
*/
export function sha1(
input: string | ArrayBuffer | ArrayBufferView,
options?: OptionsHexOutput
): Promise<string>;
export function sha1(
input: string | ArrayBuffer | ArrayBufferView,
options: OptionBufferOutput
): Promise<ArrayBuffer>;
/**
@returns The Hex-encoded hash.
@example
```
import {sha256} from 'crypto-hash';
console.log(await sha256('🦄'));
//=> '36bf255468003165652fe978eaaa8898e191664028475f83f506dabd95298efc'
```
*/
export function sha256(
input: string | ArrayBuffer | ArrayBufferView,
options?: OptionsHexOutput
): Promise<string>;
export function sha256(
input: string | ArrayBuffer | ArrayBufferView,
options: OptionBufferOutput
): Promise<ArrayBuffer>;
/**
@returns The Hex-encoded hash.
@example
```
import {sha384} from 'crypto-hash';
console.log(await sha384('🦄'));
//=> 'a9d4dfb503394bd9701d60eb5fb1d7fb800580b43d874165103b16d311fb5c97545cb89f06c31f30e219f5b603e834ca'
```
*/
export function sha384(
input: string | ArrayBuffer | ArrayBufferView,
options?: OptionsHexOutput
): Promise<string>;
export function sha384(
input: string | ArrayBuffer | ArrayBufferView,
options: OptionBufferOutput
): Promise<ArrayBuffer>;
/**
@returns The Hex-encoded hash.
@example
```
import {sha512} from 'crypto-hash';
console.log(await sha512('🦄'));
//=> '7d9e515c59bd15d0692f9bc0c68f50f82b62a99bef4b8dc490cec165296210dff005529a4cb84a655eee6ddec82339e6bdbab21bdb287b71a543a56cfab53905'
```
*/
export function sha512(
input: string | ArrayBuffer | ArrayBufferView,
options?: OptionsHexOutput
): Promise<string>;
export function sha512(
input: string | ArrayBuffer | ArrayBufferView,
options: OptionBufferOutput
): Promise<ArrayBuffer>;