Class Hash

java.lang.Object
com.norswap.nanoeth.data.Hash
All Implemented Interfaces:
RLPLayoutable
Direct Known Subclasses:
MerkleRoot

@Wrapper
public class Hash
extends Object
implements RLPLayoutable
Represents a 256-bit (32 bytes) Keccak hash.
See Also:
Hashing
  • Field Details

    • ZERO

      public static final Hash ZERO
      A hash composed of only zero bytes.
    • EMPTY_SEQ_HASH

      public static final Hash EMPTY_SEQ_HASH
      Hash of the empty RLP sequence.

      Can notably be compared against the uncle hash of a block header to see if the block has any uncles.

    • bytes

      public final byte[] bytes
      The bytes making up the hash.
  • Constructor Details

    • Hash

      public Hash​(@Retained byte[] bytes)
    • Hash

      public Hash​(String hexString)
      Creates a hash from a hex string (e.g. 0x123).

      If the post-0x part of the hex string is not 64 characters long, the hash will be padded with zeroes at the start so that it is 32 bytes long.

  • Method Details