public final class RepeatingDecorator extends Object implements HashingAlgorithm
Decorator for hashing algorithms which repeats hashing multiple times. E.g. 3 repeats results in hash(hash(hash(input)))
Example:
HashingAlgorithm sha256 = new SHA256();
HashingAlgorithm decorator = new RepeatingDecorator(alg, 27);
decorator.hash("whateverYouWant");
| Modifier | Constructor and Description |
|---|---|
protected |
RepeatingDecorator(HashingAlgorithm hashingAlgorithm,
int repeatsCount)
Creates a new repeating decorator with specified algorithm a repeats count.
|
| 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 RepeatingDecorator(HashingAlgorithm hashingAlgorithm, int repeatsCount)
hashingAlgorithm - algorithm to be repeatedrepeatsCount - number of repeats of hashingpublic String hash(String input) throws HashingException
Repeats algorithm by specified number of times.
hash in interface HashingAlgorithminput - input text to be hashedHashingException - possible exception during hashing processpublic byte[] hash(byte[] input)
throws HashingException
Repeats algorithm by specified number of times.
hash in interface HashingAlgorithminput - input to be hashedHashingException - possible exception during hashing processCopyright © 2019. All rights reserved.