- * see https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr1.pdf + * see NIST.SP.800-56Cr1 */ @SuppressWarnings("WeakerAccess") public interface HFunction { @@ -53,7 +53,7 @@ public interface HFunction { * with hash type functions and may throw an {@link UnsupportedOperationException}. Call this before {@link #update(byte[])} * * @param 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 + * HMAC an empty byte array the length of the underyling hash function (e.g. 32 * bytes for SHA-256) */ void init(byte[] key); @@ -92,7 +92,7 @@ public interface HFunction { int getHFuncOutputBytes(); /** - * Update the function with a new input that will internally added to the + * Update the function with a new input that will internally add to the * already available input * * @param array to process @@ -235,8 +235,7 @@ static int getBlockLengthByte(String algorithm) { if (name.startsWith("sha1") || name.startsWith("sha224") || name.startsWith("sha256") || name.startsWith("hmacsha1") || name.startsWith("hmacsha256")) { return 64; - } else if (name.startsWith("sha512") || name.startsWith("sha384") || name.equals("sha256") - || name.startsWith("hmacsha512")) { + } else if (name.startsWith("sha512") || name.startsWith("sha384") || name.startsWith("hmacsha512")) { return 128; } else if (name.startsWith("sha3224")) { return 144; diff --git a/src/main/java/at/favre/lib/crypto/singlstepkdf/SingleStepKdf.java b/src/main/java/at/favre/lib/crypto/singlstepkdf/SingleStepKdf.java index 27e2587..4f29cc8 100644 --- a/src/main/java/at/favre/lib/crypto/singlstepkdf/SingleStepKdf.java +++ b/src/main/java/at/favre/lib/crypto/singlstepkdf/SingleStepKdf.java @@ -117,7 +117,7 @@ public String getHFunctionDescription() { * * @param sharedSecretZ called 'Z' in the spec: a byte string that represents the shared secret * @param outLengthBytes called 'L' in the spec: a positive integer that indicates the length - * (in bytes) of the secret keying material to be derived (ie. how long the output + * (in bytes) of the secret keying material to be derived (i.e. how long the output * will be in bytes) * @return derived keying material (to use as secret key) */ @@ -134,13 +134,13 @@ public byte[] derive(byte[] sharedSecretZ, * * @param sharedSecretZ called 'Z' in the spec: a byte string that represents the shared secret * @param outLengthBytes called 'L' in the spec: a positive integer that indicates the length - * (in bytes) of the secret keying material to be derived (ie. how long the output + * (in bytes) of the secret keying material to be derived (i.e. how long the output * will be in bytes) - * @param fixedInfo a bit string of context-specific data that is appropriate for the relying + * @param fixedInfo a bit string of context-specific data that is appropriate for the relying on * key-establishment scheme. FixedInfo may, for example, include appropriately * formatted representations of the values of salt and/or L. The inclusion of * additional copies of the values of salt and L in FixedInfo would ensure that - * each block of derived keying material is affected by all of the information + * each block of derived keying material is affected by all the information * conveyed in OtherInput. See [SP 800-56A] and [SP 800-56B] for more detailed * recommendations concerning the format and content of FixedInfo. * @return derived keying material (to use as secret key) @@ -157,15 +157,15 @@ public byte[] derive(byte[] sharedSecretZ, * * @param sharedSecretZ called 'Z' in the spec: a byte string that represents the shared secret * @param outLengthBytes called 'L' in the spec: a positive integer that indicates the length - * (in bytes) of the secret keying material to be derived (ie. how long the output + * (in bytes) of the secret keying material to be derived (i.e. how long the output * will be in bytes) * @param salt (secret or non-secret) byte string that should be provided when HMAC h * function is used, if null is passed the default_salt is used - * @param fixedInfo a bit string of context-specific data that is appropriate for the relying + * @param fixedInfo a bit string of context-specific data that is appropriate for the relying on * key-establishment scheme. FixedInfo may, for example, include appropriately * formatted representations of the values of salt and/or L. The inclusion of * additional copies of the values of salt and L in FixedInfo would ensure that - * each block of derived keying material is affected by all of the information + * each block of derived keying material is affected by all the information * conveyed in OtherInput. See [SP 800-56A] and [SP 800-56B] for more detailed * recommendations concerning the format and content of FixedInfo. * @return derived keying material (to use as secret key)