Hasher.d.ts
1.6 KB
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
import { BufferedBlockAlgorithm, BufferedBlockAlgorithmProps } from "./BufferedBlockAlgorithm";
import type { Word32Array } from "../Word32Array";
export interface HasherProps extends BufferedBlockAlgorithmProps {
blockSize: number;
}
export declare class Hasher extends BufferedBlockAlgorithm {
protected _props?: Partial<HasherProps>;
protected _blockSize: number;
constructor(props?: Partial<HasherProps>);
get blockSize(): number;
/**
* Resets this hasher to its initial state.
*
* @example
* hasher.reset();
*/
reset(data?: Word32Array, nBytes?: number): void;
/**
* Updates this hasher with a message.
*
* @param {Word32Array|string} messageUpdate The message to append.
* @return {Hasher} This hasher.
* @example
* hasher.update('message');
* hasher.update(wordArray);
*/
update(messageUpdate: Word32Array | string): this;
/**
* Finalizes the hash computation.
* Note that the finalize operation is effectively a destructive, read-once operation.
*
* @param {Word32Array|string?} messageUpdate (Optional) A final message update.
* @return {Word32Array} The hash.
* @example
* var hash = hasher.finalize();
* var hash = hasher.finalize('message');
* var hash = hasher.finalize(wordArray);
*/
finalize(messageUpdate?: Word32Array | string): Word32Array;
/**
* @abstract
*/
protected _doReset(): void;
/**
* @abstract
*/
protected _doFinalize(): Word32Array;
}