UNPKG

1.41 kBTypeScriptView Raw
1import { Hash256 } from './types';
2import { BytesList } from './serdes/binary-serializer';
3/**
4 * Class for hashing with SHA512
5 * @extends BytesList So SerializedTypes can write bytes to a Sha512Half
6 */
7declare class Sha512Half extends BytesList {
8 private hash;
9 /**
10 * Construct a new Sha512Hash and write bytes this.hash
11 *
12 * @param bytes bytes to write to this.hash
13 * @returns the new Sha512Hash object
14 */
15 static put(bytes: Uint8Array): Sha512Half;
16 /**
17 * Write bytes to an existing Sha512Hash
18 *
19 * @param bytes bytes to write to object
20 * @returns the Sha512 object
21 */
22 put(bytes: Uint8Array): Sha512Half;
23 /**
24 * Compute SHA512 hash and slice in half
25 *
26 * @returns half of a SHA512 hash
27 */
28 finish256(): Uint8Array;
29 /**
30 * Constructs a Hash256 from the Sha512Half object
31 *
32 * @returns a Hash256 object
33 */
34 finish(): Hash256;
35}
36/**
37 * compute SHA512 hash of a list of bytes
38 *
39 * @param args zero or more arguments to hash
40 * @returns the sha512half hash of the arguments.
41 */
42declare function sha512Half(...args: Uint8Array[]): Uint8Array;
43/**
44 * Construct a transactionID from a Serialized Transaction
45 *
46 * @param serialized bytes to hash
47 * @returns a Hash256 object
48 */
49declare function transactionID(serialized: Uint8Array): Hash256;
50export { Sha512Half, sha512Half, transactionID };