public abstract class HashingAlgorithmBuilder extends Object
HashingAlgorithms factory for creating instances.DigestAlgorithm| Modifier and Type | Field and Description |
|---|---|
protected BytesRepresentation |
bytesRepresentation |
protected String |
encoding |
| Modifier | Constructor and Description |
|---|---|
protected |
HashingAlgorithmBuilder() |
| Modifier and Type | Method and Description |
|---|---|
abstract HashingAlgorithm |
build()
Builds final hashing algorithm instance.
|
HashingAlgorithmBuilder |
bytesRepresentation(BytesRepresentation bytesRepresentation)
Sets how byte arrays will be represented in strings.
|
HashingAlgorithmBuilder |
encoding(String encoding)
Sets encoding for strings of input and output.
|
RepeatingDecoratorBuilder |
repeated(int repeats)
Builds a hashing algorithm and wraps it into repeating decorator builder.
|
SaltingAdapterBuilder |
salted()
Builds a hashing algorithm and wraps it by salting adapter builder.
|
SaltingAdapterBuilder |
salted(Combining combining)
Builds a hashing algorithm and wraps it by salting adapter builder with custom combine algorithm.
|
protected BytesRepresentation bytesRepresentation
protected String encoding
public HashingAlgorithmBuilder bytesRepresentation(BytesRepresentation bytesRepresentation) throws IllegalArgumentException
HexRepresentation is used.bytesRepresentation - byte array representation strategyIllegalArgumentException - exception if passed key BytesRepresentation is nullpublic HashingAlgorithmBuilder encoding(String encoding) throws IllegalArgumentException
encoding - encoding to be setIllegalArgumentException - exception if given encoding is null or not supportedpublic SaltingAdapterBuilder salted()
Note that you should call this method when you are finished with properties of hashing algorithm.
public SaltingAdapterBuilder salted(Combining combining) throws IllegalArgumentException
Note that you should call this method when you are finished with properties of hashing algorithm.
combining - combine algorithm for input text and saltIllegalArgumentException - exception if passed key Combining is nullpublic RepeatingDecoratorBuilder repeated(int repeats) throws IllegalArgumentException
Note that you should call this method when you are finished with properties of hashing algorithm.
repeats - count of repeatsIllegalArgumentException - exception if passed repeats are lower than 1public abstract HashingAlgorithm build()
Copyright © 2019. All rights reserved.