module SSZ
Defined in:
ssz.crssz/constants.cr
ssz/hash.cr
ssz/hash_tree_root.cr
ssz/merkleization.cr
ssz/serialization.cr
Constant Summary
-
BITS_PER_BYTE =
8
-
BYTES_PER_CHUNK =
32
-
BYTES_PER_LENGTH_OFFSET =
4
-
EMPTY_CHUNK =
Bytes.new(BYTES_PER_CHUNK, 0_u8)
-
NUM_ZERO_HASHES =
100
-
VERSION =
"0.1.0"
-
ZERO_HASHES =
make_zero_hashes
Class Method Summary
- .bit_length(n : Int) : UInt64
-
.bitwise_merkleize(chunks : Enumerable(Bytes), padding : UInt64) : Bytes
Given ordered
SSZ::BYTES_PER_CHUNK
-byte chunks, if necessary utilize zero chunks so that the number of chunks is a power of two, Merkleize the chunks, and return the root. - .hash(data : Bytes) : Bytes
- .merge_chunks(layers : Array(Bytes), current_root : Bytes, i, count, depth : UInt64)
-
.mix_in_length(root : Bytes, length : Bytes) : Bytes
Returns Merkle root of given root and a length (
UInt256
little-endian serialization) -
.mix_in_type(root : Bytes, type_index : Bytes) : Bytes
Returns Merkle root of given root and a type_index (
UInt256
little-endian serialization) -
.mix_in_type(root : Bytes, type_index : SSZ::Offset)
Returns Merkle root of given root and a type_index (
UInt256
little-endian serialization) -
.pack(serialized_items : Enumerable(Bytes)) : Array(Bytes)
Packs SSZ-encoded objects into
SSZ::BYTES_PER_CHUNK
-byte chunks, right-pad the last chunk with zero bytes, and return the chunks.
Class Method Detail
Given ordered SSZ::BYTES_PER_CHUNK
-byte chunks, if necessary utilize zero chunks so that the
number of chunks is a power of two, Merkleize the chunks, and return the root.
Note that merkleize on a single chunk is simply that chunk, i.e. the identity
when the number of chunks is one.
Returns Merkle root of given root and a length (UInt256
little-endian serialization)
Returns Merkle root of given root and a type_index (UInt256
little-endian serialization)
Returns Merkle root of given root and a type_index (UInt256
little-endian serialization)
Packs SSZ-encoded objects into SSZ::BYTES_PER_CHUNK
-byte chunks,
right-pad the last chunk with zero bytes, and return the chunks.