public class MerkleTree extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
MerkleTree.BinaryNode
The BinaryNode class should be treated as immutable, though immutable is not enforced in the
current design.
|
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
INT_BYTES |
static byte |
INTERNAL_SIG_TYPE |
static byte |
LEAF_SIG_TYPE |
static int |
LONG_BYTES |
static int |
MAGIC_HDR |
| 构造器和说明 |
|---|
MerkleTree(List<String> leafSignatures)
Use this constructor to create a MerkleUtil from a list of leaf signatures.
|
MerkleTree(MerkleTree.BinaryNode treeRoot,
int numNodes,
int height,
List<String> leafSignatures)
Use this constructor when you have already constructed the tree of Nodes (from
deserialization).
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
getHeight() |
int |
getNumNodes() |
MerkleTree.BinaryNode |
getRoot() |
byte[] |
serialize()
Serialization format:
(magicheader:int)(numnodes:int)[(nodetype:byte)(siglength:int)(signature:[]byte)].
|
public static final int MAGIC_HDR
public static final int INT_BYTES
public static final int LONG_BYTES
public static final byte LEAF_SIG_TYPE
public static final byte INTERNAL_SIG_TYPE
public MerkleTree(List<String> leafSignatures)
leafSignatures - Listpublic MerkleTree(MerkleTree.BinaryNode treeRoot, int numNodes, int height, List<String> leafSignatures)
treeRoot - numNodes - height - leafSignatures - public byte[] serialize()
public int getNumNodes()
public MerkleTree.BinaryNode getRoot()
public int getHeight()
Copyright © 2020. All Rights Reserved.