Package convex.core.crypto
Class Hashing
java.lang.Object
convex.core.crypto.Hashing
Class for static Hashing functionality
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageDigest
Gets the Convex default MessageDigest.static MessageDigest
Gets a MessageDigest for Keccak256.static MessageDigest
Gets a thread-local instance of a SHA256 MessageDigeststatic MessageDigest
Gets a thread-local instance of a SHA3-256 MessageDigeststatic Hash
sha256(byte[] data)
Computes the SHA3-256 hash of byte datastatic Hash
Computes the SHA-256 hash of a stringstatic Hash
sha3(byte[] data)
Computes the SHA3-256 hash of byte datastatic Hash
Computes the SHA-256 hash of a string
-
Constructor Details
-
Hashing
public Hashing()
-
-
Method Details
-
sha3
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
Computes the SHA3-256 hash of byte data- Parameters:
data
- Byte array to hash- Returns:
- SHA3-256 Hash value
-
getSHA3Digest
Gets a thread-local instance of a SHA3-256 MessageDigest- Returns:
- MessageDigest instance
-
getDigest
Gets the Convex default MessageDigest. Guaranteed thread safe, will be either a new or ThreadLocal instance.- Returns:
- MessageDigest
-
getKeccak256Digest
Gets a MessageDigest for Keccak256. Guaranteed thread safe, will be either a new or ThreadLocal instance.- Returns:
- MessageDigest
-
getSHA256Digest
Gets a thread-local instance of a SHA256 MessageDigest- Returns:
- MessageDigest instance
-
sha256
Computes the SHA3-256 hash of byte data- Parameters:
data
- Byte array to hash- Returns:
- SHA3-256 Hash value
-
sha256
Computes the SHA-256 hash of a string- Parameters:
message
- Message to Hash (in UTF8 encoding)- Returns:
- Hash of UTF-8 encoded string
-