public class SDFGenerator extends java.lang.Object implements DerivationFunction
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_ITERATIONS |
private Digest |
digest |
private int |
iterations |
private byte[] |
S1 |
private byte[] |
S2 |
Constructor and Description |
---|
SDFGenerator(Digest digest)
Define the digest to use for the SDF generator as well as the number
of iterations that the digest is applied.
|
SDFGenerator(Digest digest,
int iterations)
Define the digest to use for the SDF generator as well as the number
of iterations that the digest is applied.
|
Modifier and Type | Method and Description |
---|---|
int |
generateBytes(byte[] out,
int outOff,
int len)
Fill the length bytes specified of the output buffer with bytes generated from
the seed derivation function (SDF).
|
Digest |
getDigest()
Returns the digest being used by the SDF
|
void |
init(DerivationParameters param) |
private Digest digest
private static final int DEFAULT_ITERATIONS
private int iterations
private byte[] S1
private byte[] S2
public SDFGenerator(Digest digest, int iterations)
digest
- The hash digest to use, SHA256 is recommendediterations
- The number of iterations that the digest is appliedjava.lang.IllegalArgumentException
- If the number of iterations specified is less than 1public SDFGenerator(Digest digest)
digest
- The hash digest to use, SHA256 is recommendedpublic void init(DerivationParameters param)
init
in interface DerivationFunction
public int generateBytes(byte[] out, int outOff, int len) throws DataLengthException, java.lang.IllegalArgumentException
generateBytes
in interface DerivationFunction
out
- The output buffer to fill with the bytes generated for the seedoutOff
- The offset in the output buffer to populatelen
- The length of the output, if no length specified size of digest is usedjava.lang.IllegalArgumentException
- if the size of the request will cause an overflow.DataLengthException
- if the out buffer is too small.public Digest getDigest()
getDigest
in interface DerivationFunction