-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathindex.d.ts
104 lines (92 loc) · 3.49 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
export interface Blake2bCTX {
b: Uint8Array;
h: Uint32Array;
t: number;
c: number;
outlen: number;
}
type InputBytes = string | Uint8Array;
/**
* Creates a Blake2b hashing context
* @param outlen between 1 and 64
* @param key optional
* @param salt optional salt bytes, string, Buffer or Uint8Array
* @param personal optional personal bytes, string, Buffer or Uint8Array
* @returns the hashing context
*/
export declare function blake2bInit(outlen?: number, key?: Uint8Array, salt?: InputBytes, personal?: InputBytes): Blake2bCTX;
/**
* Updates a Blake2b streaming hash
* @param ctx hashing context from blake2bInit()
* @param input Byte array
*/
export declare function blake2bUpdate(ctx: Blake2bCTX, input: ArrayLike<number>): void;
/**
* Completes a Blake2b streaming hash
* @param ctx hashing context from blake2bInit()
* @returns the final hash
*/
export declare function blake2bFinal(ctx: Blake2bCTX): Uint8Array;
/**
*
* @param input the input bytes, as a string, Buffer, or Uint8Array
* @param key optional key Uint8Array, up to 64 bytes
* @param outlen optional output length in bytes, default 64
* @param salt optional salt bytes, string, Buffer or Uint8Array
* @param personal optional personal bytes, string, Buffer or Uint8Array
* @returns an n-byte Uint8Array
*/
export declare function blake2b(input: InputBytes, key?: Uint8Array, outlen?: number, salt?: InputBytes, personal?: InputBytes): Uint8Array;
/**
* Computes the Blake2b hash of a string or byte array
*
* @param input the input bytes, as a string, Buffer, or Uint8Array
* @param key optional key Uint8Array, up to 64 bytes
* @param outlen optional output length in bytes, default 64
* @param salt optional salt bytes, string, Buffer or Uint8Array
* @param personal optional personal bytes, string, Buffer or Uint8Array
* @returns an n-byte hash in hex, all lowercase
*/
export declare function blake2bHex(input: InputBytes, key?: Uint8Array, outlen?: number, salt?: InputBytes, personal?: InputBytes): string;
export interface Blake2sCTX {
h: Uint32Array;
b: Uint8Array;
c: number;
t: number;
outlen: number;
}
/**
* Creates a Blake2s hashing context
* @param outlen between 1 and 32
* @param key optional Uint8Array key
* @returns the hashing context
*/
export declare function blake2sInit(outlen: number, key?: Uint8Array): Blake2sCTX;
/**
* Updates a Blake2s streaming hash
* @param ctx hashing context from blake2sinit()
* @param input byte array
*/
export declare function blake2sUpdate(ctx: Blake2sCTX, input: ArrayLike<number>): void;
/**
* Completes a Blake2s streaming hash
* @param ctx hashing context from blake2sinit()
* @returns Uint8Array containing the message digest
*/
export declare function blake2sFinal(ctx: Blake2sCTX): Uint8Array;
/**
* Computes the Blake2s hash of a string or byte array, and returns a Uint8Array
* @param input the input bytes, as a string, Buffer, or Uint8Array
* @param key optional key Uint8Array, up to 32 bytes
* @param outlen optional output length in bytes, defaults to 64
* @returns an n-byte Uint8Array
*/
export declare function blake2s(input: InputBytes, key?: Uint8Array, outlen?: number): Uint8Array;
/**
*
* @param input the input bytes, as a string, Buffer, or Uint8Array
* @param key optional key Uint8Array, up to 32 bytes
* @param outlen optional output length in bytes, defaults to 64
* @returns an n-byte hash in hex, all lowercase
*/
export declare function blake2sHex(input: InputBytes, key?: Uint8Array, outlen?: number): string;