public class MessageDigestHelper extends Object
MessageDigest
class to perform the hashing. The helper works with a set MessageDigestAlgorithm which is defined at
creation.| Constructor and Description |
|---|
MessageDigestHelper()
Create a helper with the
MessageDigestAlgorithm.DEFAULT algorithm. |
MessageDigestHelper(MessageDigestAlgorithm algorithm)
Create a helper with the given
MessageDigestAlgorithm algorithm. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
digest(byte[] data)
Gets the digest of the data (the hash) using the helper's defined algorithm.
|
int |
getDigestLength()
Get the length of the digest (the hash) according to the helper's defined algorithm.
|
public MessageDigestHelper()
throws NoSuchAlgorithmException
MessageDigestAlgorithm.DEFAULT algorithm.NoSuchAlgorithmException - thrown if the algorithm is not supportedpublic MessageDigestHelper(MessageDigestAlgorithm algorithm) throws NoSuchAlgorithmException
MessageDigestAlgorithm algorithm.algorithm - the algorithm for the helperNoSuchAlgorithmException - thrown if the algorithm is not supportedpublic byte[] digest(byte[] data)
data - the data to compute the digest (to hash)public int getDigestLength()
Copyright © 2021. All rights reserved.