Package org.jeegen.jee6.util
Class AbstractMessageDigest
- java.lang.Object
-
- org.jeegen.jee6.util.AbstractMessageDigest
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractMessageDigest.DIGEST
This enumeration lists the supported message digests.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMessageDigest(AbstractMessageDigest.DIGEST digest)
This constructor initializes this class with the given hash algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
encode(byte[] buffer)
This method computes the hash of a byte array.String
encode(String input)
This method computes the hash of a text.String
encode(String input, Charset charset)
This method computes the SHA1 hash of a text.
-
-
-
Constructor Detail
-
AbstractMessageDigest
protected AbstractMessageDigest(AbstractMessageDigest.DIGEST digest)
This constructor initializes this class with the given hash algorithm.- Parameters:
digest
- The hash to use.
-
-
Method Detail
-
encode
public String encode(String input) throws UnsupportedEncodingException
This method computes the hash of a text.- Parameters:
input
- The text to hash.- Returns:
- The hash.
- Throws:
UnsupportedEncodingException
- when the used encoding is unsupported.
-
encode
public String encode(String input, Charset charset) throws UnsupportedEncodingException
This method computes the SHA1 hash of a text.- Parameters:
input
- The text to hash.charset
- The encoding charset to use.- Returns:
- The hash.
- Throws:
UnsupportedEncodingException
- when the used encoding is unsupported.
-
encode
public String encode(byte[] buffer)
This method computes the hash of a byte array.- Parameters:
buffer
- The byte array to hash.- Returns:
- The hash.
-
-