public interface HFunction
MessageDigest or Mac
Options for the Auxiliary Function H:
An example on how to use a H-function
final HFunction func = factory.createInstance();
final int hashLength = func.getHFuncOutputBytes();
byte[] out = new byte[hashLength];
func.update(keyData);
out = func.calculate()
see https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr1.pdf
| Modifier and Type | Interface and Description |
|---|---|
static class |
HFunction.MacHFunction
HMAC implementation of the H function
|
static class |
HFunction.MessageDigestHFunction
Hash implementation of the H function.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
calculate()
After adding the input through
update(byte[]) calculate the output of the
H-function |
int |
getHFuncOutputBytes()
Formally: a positive integer that indicates the length of the output of
the auxiliary function, H, that is used to derive blocks of secret keying material.
|
void |
init(byte[] key)
Optional keying of the H function.
|
boolean |
requireInit()
If the function requires a key to be provided in the
init(byte[]) |
void |
reset()
Resets the function for further use.
|
void |
update(byte[] array)
Update the function with a new input that will internally added to the
already available input
|
void init(byte[] key)
UnsupportedOperationException. Call this before update(byte[])key - to be used; if null is passed, default_salt is used, which is in the case of
HMAC a empty byte array the length of the underyling hash function (e.g. 32
bytes for SHA-256)boolean requireInit()
init(byte[])int getHFuncOutputBytes()
The spec describes the length in bits, but for practical reasons it will return bytes.
Practically the length of output hash/hmac/kmac function. E.g. SHA-256 or HMAC_SHA-256 will output 32 byte long block.
void update(byte[] array)
array - to processbyte[] calculate()
update(byte[]) calculate the output of the
H-functionvoid reset()
Copyright © 2018. All rights reserved.