Package at.favre.lib.crypto.singlstepkdf
Class HFunction.MessageDigestHFunction
- java.lang.Object
-
- at.favre.lib.crypto.singlstepkdf.HFunction.MessageDigestHFunction
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface at.favre.lib.crypto.singlstepkdf.HFunction
HFunction.MacHFunction, HFunction.MessageDigestHFunction, HFunction.Util
-
-
Constructor Summary
Constructors Constructor Description MessageDigestHFunction(MessageDigest digest)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]calculate()After adding the input throughHFunction.update(byte[])calculate the output of the H-functionintgetHFuncInputBlockLengthBytes()Formally: a positive integer that indicates the length of the input block size of the auxiliary function, H.intgetHFuncOutputBytes()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.voidinit(byte[] key)Optional keying of the H function.booleanrequireInit()If the function requires a key to be provided in theHFunction.init(byte[])voidreset()Resets the function for further use.voidupdate(byte[] array)Update the function with a new input that will internally add to the already available input
-
-
-
Constructor Detail
-
MessageDigestHFunction
public MessageDigestHFunction(MessageDigest digest)
-
-
Method Detail
-
init
public void init(byte[] key)
Description copied from interface:HFunctionOptional keying of the H function. This is not supported with hash type functions and may throw anUnsupportedOperationException. Call this beforeHFunction.update(byte[])
-
requireInit
public boolean requireInit()
Description copied from interface:HFunctionIf the function requires a key to be provided in theHFunction.init(byte[])- Specified by:
requireInitin interfaceHFunction- Returns:
- true if user must initialize with init()
-
getHFuncInputBlockLengthBytes
public int getHFuncInputBlockLengthBytes()
Description copied from interface:HFunctionFormally: a positive integer that indicates the length of the input block size of the auxiliary function, H.The spec describes the length in bits, but for practical reasons it will return bytes.
This is required to get the salt length of no salt is provided. See the definition in NIST SP 800-56C REV. 1, Table 2
- Specified by:
getHFuncInputBlockLengthBytesin interfaceHFunction- Returns:
- input block size length in byte (sha-256 is e.g. 64, sha-512: 128)
-
getHFuncOutputBytes
public int getHFuncOutputBytes()
Description copied from interface:HFunctionFormally: 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.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.
- Specified by:
getHFuncOutputBytesin interfaceHFunction- Returns:
- output length in byte
-
update
public void update(byte[] array)
Description copied from interface:HFunctionUpdate the function with a new input that will internally add to the already available input
-
calculate
public byte[] calculate()
Description copied from interface:HFunctionAfter adding the input throughHFunction.update(byte[])calculate the output of the H-function
-
-