BufferedBlockAlgorithm.d.ts
1.7 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
import { Word32Array } from "../Word32Array";
export interface BufferedBlockAlgorithmProps {
data: Word32Array;
nBytes: number;
}
export declare class BufferedBlockAlgorithm {
protected _props?: Partial<BufferedBlockAlgorithmProps>;
protected _data: Word32Array;
protected _nBytes: number;
protected _minBufferSize: number;
protected _blockSize: number;
constructor(props?: Partial<BufferedBlockAlgorithmProps>);
get blockSize(): number;
/**
* Resets this block algorithm's data buffer to its initial state.
*
* @example
* bufferedBlockAlgorithm.reset();
*/
reset(data?: Word32Array, nBytes?: number): void;
/**
* Adds new data to this block algorithm's buffer.
*
* @param {Word32Array|string} data The data to append. Strings are converted to a WordArray using UTF-8.
* @example
* bufferedBlockAlgorithm.append('data');
* bufferedBlockAlgorithm.append(wordArray);
*/
protected _append(data: Word32Array | string): void;
/**
* Processes available data blocks.
* This method invokes doProcessBlock(offset), which must be implemented by a concrete subtype.
*
* @param {boolean?} doFlush Whether all blocks and partial blocks should be processed.
* @return {Word32Array} The processed data.
* @example
* var processedData = bufferedBlockAlgorithm.process();
* var processedData = bufferedBlockAlgorithm.process(!!'flush');
*/
protected _process(doFlush?: boolean): Word32Array;
/**
* @abstract
*/
protected _doProcessBlock(words: number[], offset: number): void;
}