module Rlp
Overview
The Rlp module implementing Ethereum's Recursive Length Prefix
for arbitrary data encoding and decoding.
Defined in:
rlp.crutil.cr
version.cr
Constant Summary
-
EMPTY_ARRAY =
Bytes[OFFSET_ARRAY] -
An empty array is defined as
0xC0. -
EMPTY_STRING =
Bytes[OFFSET_STRING] -
An empty string is defined as
0x80. -
LIMIT_LONG =
(BigInt.new(256)) ** (BigInt.new(8)) -
The size limit of large data objects to be encoded is
256 ** 8. -
LIMIT_SHORT =
56 -
The size limit of small data objects to be encoded is
56. -
OFFSET_ARRAY =
192 -
The offset for array list encoding is
192. -
OFFSET_STRING =
128 -
The offset for string literal encoding is
128. -
VERSION =
"0.1.0" -
The version of the
Rlpmodule shard.
Class Method Summary
-
.decode(blob)
decodes arbitrary data from a recursive length prefix blob
-
.encode(b : Bytes)
rlp-encodes binary data
-
.encode(l : Array)
rlp-encodes lists data
-
.encode(s : String)
rlp-encodes string data
-
.encode(i : Int)
rlp-encodes scalar data
-
.encode(c : Char)
rlp-encodes characters
-
.encode(o : Bool)
rlp-encodes boolean data
-
.get_length(data : Bytes)
gets the length of the input data using the first byte