Class Hashing

java.lang.Object
convex.core.crypto.Hashing

public class Hashing extends Object
Class for static Hashing functionality
  • Constructor Details

    • Hashing

      public Hashing()
  • Method Details

    • sha3

      public static Hash sha3(String message)
      Computes the SHA-256 hash of a string
      Parameters:
      message - Message to hash (in UTF-8 encoding)
      Returns:
      Hash of UTF-8 encoded string
    • sha3

      public static Hash sha3(byte[] data)
      Computes the SHA3-256 hash of byte data
      Parameters:
      data - Byte array to hash
      Returns:
      SHA3-256 Hash value
    • getSHA3Digest

      public static MessageDigest getSHA3Digest()
      Gets a thread-local instance of a SHA3-256 MessageDigest
      Returns:
      MessageDigest instance
    • getDigest

      public static MessageDigest getDigest()
      Gets the Convex default MessageDigest. Guaranteed thread safe, will be either a new or ThreadLocal instance.
      Returns:
      MessageDigest
    • getKeccak256Digest

      public static MessageDigest getKeccak256Digest()
      Gets a MessageDigest for Keccak256. Guaranteed thread safe, will be either a new or ThreadLocal instance.
      Returns:
      MessageDigest
    • getSHA256Digest

      public static MessageDigest getSHA256Digest()
      Gets a thread-local instance of a SHA256 MessageDigest
      Returns:
      MessageDigest instance
    • sha256

      public static Hash sha256(byte[] data)
      Computes the SHA3-256 hash of byte data
      Parameters:
      data - Byte array to hash
      Returns:
      SHA3-256 Hash value
    • sha256

      public static Hash sha256(String message)
      Computes the SHA-256 hash of a string
      Parameters:
      message - Message to Hash (in UTF8 encoding)
      Returns:
      Hash of UTF-8 encoded string