java.lang.Object
com.hedera.hashgraph.sdk.EthereumEncoding
Helpers for Ethereum RLP canonical integer encoding: big-endian, no leading zeros, zero is the empty byte string.
-
Method Summary
Modifier and TypeMethodDescription(package private) static byte[]Encodevas canonical minimal big-endian bytes.(package private) static BigIntegerethBytesToBigInt(byte[] b) Decode canonical bytes to aBigInteger.(package private) static longethBytesToLong(byte[] b) Decode canonical bytes to a long.(package private) static byte[]uint64ToEthBytes(long v) Encodevas canonical minimal big-endian bytes.
-
Method Details
-
uint64ToEthBytes
static byte[] uint64ToEthBytes(long v) Encodevas canonical minimal big-endian bytes. Zero is encoded as an empty byte array.- Parameters:
v- the unsigned value to encode- Returns:
- the canonical big-endian byte representation
-
ethBytesToLong
static long ethBytesToLong(byte[] b) Decode canonical bytes to a long. An empty array decodes to 0. Input longer than 8 bytes is truncated to the low 8 bytes.- Parameters:
b- the canonical big-endian bytes- Returns:
- the decoded value
-
bigIntToEthBytes
Encodevas canonical minimal big-endian bytes. Null and zero are encoded as an empty byte array. Negative values encode their absolute value.- Parameters:
v- the value to encode- Returns:
- the canonical big-endian byte representation
-
ethBytesToBigInt
Decode canonical bytes to aBigInteger. An empty array decodes to 0.- Parameters:
b- the canonical big-endian bytes- Returns:
- the decoded value
-