UNPKG

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