public final class DigestAlgorithm extends Object implements HashingAlgorithm
Abstract class for hashing algorithm which uses MessageDigest for hashing.
This class is immutable and can be considered thread safe. It is not allowed to extend this class to ensure it stays that way.
| Modifier | Constructor and Description |
|---|---|
protected |
DigestAlgorithm(String digestName,
BytesRepresentation bytesRepresentation,
String encoding)
Creates a new instance with given encoding.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
hash(byte[] input)
Creates a hash from input bytes.
|
String |
hash(String input)
Creates a hash from input text.
|
protected DigestAlgorithm(String digestName, BytesRepresentation bytesRepresentation, String encoding)
digestName - name of the digestbytesRepresentation - representation of byte arrays in Stringencoding - encoding used for stringspublic byte[] hash(byte[] input)
throws HashingException
HashingAlgorithmhash in interface HashingAlgorithminput - input to be hashedHashingException - possible exception during hashing processpublic String hash(String input) throws HashingException
HashingAlgorithmhash in interface HashingAlgorithminput - input text to be hashedHashingException - possible exception during hashing processCopyright © 2014. All rights reserved.