Class Sha256Hash

    • Field Detail

      • EMPTY

        public static final Sha256Hash EMPTY
        The hash of an empty byte array, which can be used as a sentinel value.
    • Constructor Detail

      • Sha256Hash

        public Sha256Hash​(byte[] bytes)
        Constructs a type-safe Sha256Hash object from the given hash bytes. The given byte array must be exactly 256 bits (32 bytes) in length.
      • Sha256Hash

        public Sha256Hash​(com.google.common.hash.HashCode hashCode)
    • Method Detail

      • createFrom

        public static Sha256Hash createFrom​(InputStream is)
                                     throws IOException
        This method will read all the bytes in the stream and digest them. It will attempt to close the stream as well.
        Throws:
        IOException
      • hash

        public com.google.common.hash.Hasher hash​(com.google.common.hash.Hasher hasher)
      • serializeToBase64String

        public String serializeToBase64String()
      • deSerializeFromBase64String

        public static Sha256Hash deSerializeFromBase64String​(String s)
      • serializeToHexString

        public String serializeToHexString()
      • deSerializeFromHexString

        public static Sha256Hash deSerializeFromHexString​(String s)
      • getBytes

        public byte[] getBytes()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • computeHash

        public static Sha256Hash computeHash​(byte[] bytes)
        Computes the SHA-256 hash for the given array of bytes.