This is an automated email from the ASF dual-hosted git repository.
garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new 67914a64 Javadoc
67914a64 is described below
commit 67914a649330c28146f45581b25461ce2d09eb49
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jul 11 08:12:40 2026 -0400
Javadoc
- Import once instead of using FQCN over and over.
- Better wording
- Weird formatting in some @param not needed
- Reduce vertical whitespace
- Fix type references in @param tags
- Fix Checkstyle
---
.../java/org/apache/commons/codec/Charsets.java | 2 +-
.../org/apache/commons/codec/StringDecoder.java | 2 +-
.../org/apache/commons/codec/StringEncoder.java | 2 +-
.../commons/codec/StringEncoderComparator.java | 2 +-
.../binary/AbstractBaseNCodecStreamBuilder.java | 2 +-
.../org/apache/commons/codec/binary/Base32.java | 6 +-
.../org/apache/commons/codec/binary/Base58.java | 4 +-
.../org/apache/commons/codec/binary/Base64.java | 2 +-
.../apache/commons/codec/binary/BaseNCodec.java | 15 +-
.../codec/binary/BaseNCodecInputStream.java | 4 +-
.../codec/binary/BaseNCodecOutputStream.java | 2 +-
.../apache/commons/codec/binary/BinaryCodec.java | 10 +-
.../java/org/apache/commons/codec/binary/Hex.java | 10 +-
.../apache/commons/codec/binary/StringUtils.java | 8 +-
.../org/apache/commons/codec/digest/Crypt.java | 77 ++++-----
.../apache/commons/codec/digest/DigestUtils.java | 90 +++++------
.../commons/codec/digest/HmacAlgorithms.java | 2 +-
.../org/apache/commons/codec/digest/HmacUtils.java | 149 ++++++++---------
.../org/apache/commons/codec/digest/Md5Crypt.java | 177 +++++++--------------
.../org/apache/commons/codec/digest/Sha2Crypt.java | 12 +-
.../commons/codec/language/ColognePhonetic.java | 2 +-
.../commons/codec/language/DoubleMetaphone.java | 6 +-
.../codec/language/MatchRatingApproachEncoder.java | 2 +-
.../apache/commons/codec/language/Metaphone.java | 2 +-
.../org/apache/commons/codec/language/Soundex.java | 2 +-
.../codec/language/bm/BeiderMorseEncoder.java | 4 +-
.../org/apache/commons/codec/language/bm/Lang.java | 2 +-
.../commons/codec/language/bm/Languages.java | 4 +-
.../apache/commons/codec/language/bm/NameType.java | 2 +-
.../commons/codec/language/bm/PhoneticEngine.java | 12 +-
.../org/apache/commons/codec/language/bm/Rule.java | 14 +-
.../apache/commons/codec/language/bm/RuleType.java | 2 +-
.../org/apache/commons/codec/net/PercentCodec.java | 8 +-
.../commons/codec/net/QuotedPrintableCodec.java | 8 +-
.../org/apache/commons/codec/net/RFC1522Codec.java | 18 +--
.../org/apache/commons/codec/net/URLCodec.java | 10 +-
.../java/org/apache/commons/codec/net/Utils.java | 2 +-
.../apache/commons/codec/binary/Base16Test.java | 2 +-
.../apache/commons/codec/binary/Base64Test.java | 2 +-
.../commons/codec/binary/BaseNCodecTest.java | 2 +-
.../org/apache/commons/codec/binary/HexTest.java | 4 +-
.../commons/codec/digest/MurmurHash3Test.java | 4 +-
42 files changed, 305 insertions(+), 387 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/Charsets.java
b/src/main/java/org/apache/commons/codec/Charsets.java
index 479faa90..f4dcce53 100644
--- a/src/main/java/org/apache/commons/codec/Charsets.java
+++ b/src/main/java/org/apache/commons/codec/Charsets.java
@@ -141,7 +141,7 @@ public class Charsets {
*
* @param charset
* A charset or null.
- * @return the given Charset or the default Charset if the given Charset
is null.
+ * @return The given Charset or the default Charset if the given Charset
is null.
*/
public static Charset toCharset(final Charset charset) {
return charset == null ? Charset.defaultCharset() : charset;
diff --git a/src/main/java/org/apache/commons/codec/StringDecoder.java
b/src/main/java/org/apache/commons/codec/StringDecoder.java
index 56b41c35..48d730c3 100644
--- a/src/main/java/org/apache/commons/codec/StringDecoder.java
+++ b/src/main/java/org/apache/commons/codec/StringDecoder.java
@@ -26,7 +26,7 @@ public interface StringDecoder extends Decoder {
* Decodes a String and returns a String.
*
* @param source the String to decode.
- * @return the encoded String.
+ * @return The encoded String.
* @throws DecoderException thrown if there is an error condition during
the Encoding process.
*/
String decode(String source) throws DecoderException;
diff --git a/src/main/java/org/apache/commons/codec/StringEncoder.java
b/src/main/java/org/apache/commons/codec/StringEncoder.java
index 7808d879..712e1544 100644
--- a/src/main/java/org/apache/commons/codec/StringEncoder.java
+++ b/src/main/java/org/apache/commons/codec/StringEncoder.java
@@ -26,7 +26,7 @@ public interface StringEncoder extends Encoder {
* Encodes a String and returns a String.
*
* @param source the String to encode.
- * @return the encoded String.
+ * @return The encoded String.
* @throws EncoderException thrown if there is an error condition during
the encoding process.
*/
String encode(String source) throws EncoderException;
diff --git
a/src/main/java/org/apache/commons/codec/StringEncoderComparator.java
b/src/main/java/org/apache/commons/codec/StringEncoderComparator.java
index 25ed3d39..012119aa 100644
--- a/src/main/java/org/apache/commons/codec/StringEncoderComparator.java
+++ b/src/main/java/org/apache/commons/codec/StringEncoderComparator.java
@@ -66,7 +66,7 @@ public class StringEncoderComparator implements Comparator {
* the object to compare.
* @param o2
* the object to compare to.
- * @return the Comparable.compareTo() return code or 0 if an encoding
error was caught.
+ * @return The Comparable.compareTo() return code or 0 if an encoding
error was caught.
* @see Comparable
*/
@Override
diff --git
a/src/main/java/org/apache/commons/codec/binary/AbstractBaseNCodecStreamBuilder.java
b/src/main/java/org/apache/commons/codec/binary/AbstractBaseNCodecStreamBuilder.java
index 114d3ffa..a24215c8 100644
---
a/src/main/java/org/apache/commons/codec/binary/AbstractBaseNCodecStreamBuilder.java
+++
b/src/main/java/org/apache/commons/codec/binary/AbstractBaseNCodecStreamBuilder.java
@@ -47,7 +47,7 @@ public abstract class AbstractBaseNCodecStreamBuilder<T, C
extends BaseNCodec, B
/**
* Gets the codec to encode/decode a stream.
*
- * @return the codec to encode/decode a stream.
+ * @return The codec to encode/decode a stream.
*/
protected C getBaseNCodec() {
return baseNCodec;
diff --git a/src/main/java/org/apache/commons/codec/binary/Base32.java
b/src/main/java/org/apache/commons/codec/binary/Base32.java
index 19e15fc6..a863521f 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base32.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base32.java
@@ -305,7 +305,7 @@ public class Base32 extends BaseNCodec {
* <li>If false, then use <a
href="https://datatracker.ietf.org/doc/html/rfc4648#section-6">RFC 4648 Section
6, Table 3: The Base 32
* Alphabet</a></li>
* </ul>
- * @return the encoding table that matches {@code useHex}.
+ * @return The encoding table that matches {@code useHex}.
*/
private static byte[] encodeTable(final boolean useHex) {
return useHex ? HEX_ENCODE_TABLE : ENCODE_TABLE;
@@ -315,7 +315,7 @@ public class Base32 extends BaseNCodec {
* Gets the decode table that matches the given encode table.
*
* @param encodeTable that is used to determine decode lookup table.
- * @return the matching decode table.
+ * @return The matching decode table.
*/
private static byte[] toDecodeTable(final byte[] encodeTable) {
final byte[] table = encodeTable != null ? encodeTable : ENCODE_TABLE;
@@ -776,7 +776,7 @@ public class Base32 extends BaseNCodec {
/**
* Gets the line separator (for testing only).
*
- * @return the line separator.
+ * @return The line separator.
*/
byte[] getLineSeparator() {
return lineSeparator;
diff --git a/src/main/java/org/apache/commons/codec/binary/Base58.java
b/src/main/java/org/apache/commons/codec/binary/Base58.java
index 66f9331c..6ddb8227 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base58.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base58.java
@@ -169,7 +169,7 @@ public class Base58 extends BaseNCodec {
* Gets the decode table that matches the given encode table.
*
* @param encodeTable that is used to determine decode lookup table.
- * @return the matching decode table.
+ * @return The matching decode table.
*/
private static byte[] toDecodeTable(final byte[] encodeTable) {
final byte[] table = encodeTable != null ? encodeTable : ENCODE_TABLE;
@@ -264,7 +264,7 @@ public class Base58 extends BaseNCodec {
*
* @param accumulate the binary data to encode.
* @param context the context for this encoding operation.
- * @return the buffer containing the encoded data.
+ * @return The buffer containing the encoded data.
*/
private byte[] convertToBase58(final byte[] accumulate, final Context
context) {
final StringBuilder base58 = getStringBuilder(accumulate);
diff --git a/src/main/java/org/apache/commons/codec/binary/Base64.java
b/src/main/java/org/apache/commons/codec/binary/Base64.java
index 511fa5dd..b22c9333 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base64.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base64.java
@@ -1140,7 +1140,7 @@ public class Base64 extends BaseNCodec {
/**
* Gets the line separator (for testing only).
*
- * @return the line separator.
+ * @return The line separator.
*/
byte[] getLineSeparator() {
return lineSeparator;
diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
index 1096ad45..bbd361d5 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
@@ -18,6 +18,7 @@
package org.apache.commons.codec.binary;
import java.math.BigInteger;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Objects;
import java.util.function.Supplier;
@@ -347,7 +348,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
* The maximum size buffer to allocate.
*
* <p>
- * This is set to the same size used in the JDK {@link
java.util.ArrayList}:
+ * This is set to the same size used in the JDK {@link ArrayList}:
* </p>
* <blockquote> Some VMs reserve some header words in an array. Attempts
to allocate larger arrays may result in OutOfMemoryError: Requested array size
* exceeds VM limit. </blockquote>
@@ -386,7 +387,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
* no array can be allocated.
*
* @param minCapacity the minimum capacity.
- * @return the capacity.
+ * @return The capacity.
* @throws OutOfMemoryError if the {@code minCapacity} is negative.
*/
private static int createPositiveCapacity(final int minCapacity) {
@@ -408,7 +409,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
/**
* Gets a copy of the chunk separator per RFC 2045 section 2.1.
*
- * @return the chunk separator.
+ * @return The chunk separator.
* @see <a href="https://www.ietf.org/rfc/rfc2045">RFC 2045 section 2.1</a>
* @since 1.15
*/
@@ -420,7 +421,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
* Gets the array length or 0 if null.
*
* @param array the array or null.
- * @return the array length or 0 if null.
+ * @return The array length or 0 if null.
*/
static int getLength(final byte[] array) {
return array == null ? 0 : array.length;
@@ -462,7 +463,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
*
* @param context the context to be used.
* @param minCapacity the minimum required capacity.
- * @return the resized byte[] buffer.
+ * @return The resized byte[] buffer.
* @throws OutOfMemoryError if the {@code minCapacity} is negative.
*/
private static byte[] resizeBuffer(final Context context, final int
minCapacity) {
@@ -803,7 +804,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
*
* @param size minimum spare space required.
* @param context the context to be used.
- * @return the buffer.
+ * @return The buffer.
*/
protected byte[] ensureBufferSize(final int size, final Context context) {
if (context.buffer == null) {
@@ -836,7 +837,7 @@ public abstract class BaseNCodec implements BinaryEncoder,
BinaryDecoder {
/**
* Gets the default buffer size. Can be overridden.
*
- * @return the default buffer size.
+ * @return The default buffer size.
*/
protected int getDefaultBufferSize() {
return DEFAULT_BUFFER_SIZE;
diff --git
a/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java
b/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java
index c7996939..80a7c77d 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodecInputStream.java
@@ -64,7 +64,7 @@ public class BaseNCodecInputStream<C extends BaseNCodec, T
extends BaseNCodecInp
/**
* Gets the input stream.
*
- * @return the input stream.
+ * @return The input stream.
*/
protected InputStream getInputStream() {
return inputStream;
@@ -184,7 +184,7 @@ public class BaseNCodecInputStream<C extends BaseNCodec, T
extends BaseNCodecInp
/**
* Reads one {@code byte} from this input stream.
*
- * @return the byte as an integer in the range 0 to 255. Returns -1 if EOF
has been reached.
+ * @return The byte as an integer in the range 0 to 255. Returns -1 if EOF
has been reached.
* @throws IOException if an I/O error occurs.
*/
@Override
diff --git
a/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java
b/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java
index c7c9630d..4cc1309c 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodecOutputStream.java
@@ -69,7 +69,7 @@ public class BaseNCodecOutputStream<C extends BaseNCodec, T
extends BaseNCodecOu
/**
* Gets the input stream.
*
- * @return the input stream.
+ * @return The input stream.
*/
protected OutputStream getOutputStream() {
return outputStream;
diff --git a/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java
b/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java
index 207cd879..0627b4e1 100644
--- a/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java
+++ b/src/main/java/org/apache/commons/codec/binary/BinaryCodec.java
@@ -75,7 +75,7 @@ public class BinaryCodec implements BinaryDecoder,
BinaryEncoder {
* Decodes a byte array where each byte represents an ASCII '0' or '1'.
*
* @param ascii each byte represents an ASCII '0' or '1'.
- * @return the raw encoded binary where each bit corresponds to a byte in
the byte array argument.
+ * @return The raw encoded binary where each bit corresponds to a byte in
the byte array argument.
*/
public static byte[] fromAscii(final byte[] ascii) {
if (isEmpty(ascii)) {
@@ -101,7 +101,7 @@ public class BinaryCodec implements BinaryDecoder,
BinaryEncoder {
* Decodes a char array where each char represents an ASCII '0' or '1'.
*
* @param ascii each char represents an ASCII '0' or '1'.
- * @return the raw encoded binary where each bit corresponds to a char in
the char array argument.
+ * @return The raw encoded binary where each bit corresponds to a char in
the char array argument.
*/
public static byte[] fromAscii(final char[] ascii) {
if (ascii == null || ascii.length == 0) {
@@ -213,7 +213,7 @@ public class BinaryCodec implements BinaryDecoder,
BinaryEncoder {
* Decodes a byte array where each byte represents an ASCII '0' or '1'.
*
* @param ascii each byte represents an ASCII '0' or '1'.
- * @return the raw encoded binary where each bit corresponds to a byte in
the byte array argument.
+ * @return The raw encoded binary where each bit corresponds to a byte in
the byte array argument.
* @see org.apache.commons.codec.Decoder#decode(Object)
*/
@Override
@@ -225,7 +225,7 @@ public class BinaryCodec implements BinaryDecoder,
BinaryEncoder {
* Decodes a byte array where each byte represents an ASCII '0' or '1'.
*
* @param ascii each byte represents an ASCII '0' or '1'.
- * @return the raw encoded binary where each bit corresponds to a byte in
the byte array argument.
+ * @return The raw encoded binary where each bit corresponds to a byte in
the byte array argument.
* @throws DecoderException if argument is not a byte[], char[] or String.
* @see org.apache.commons.codec.Decoder#decode(Object)
*/
@@ -278,7 +278,7 @@ public class BinaryCodec implements BinaryDecoder,
BinaryEncoder {
* Decodes a String where each char of the String represents an ASCII '0'
or '1'.
*
* @param ascii String of '0' and '1' characters.
- * @return the raw encoded binary where each bit corresponds to a byte in
the byte array argument.
+ * @return The raw encoded binary where each bit corresponds to a byte in
the byte array argument.
* @see org.apache.commons.codec.Decoder#decode(Object)
*/
public byte[] toByteArray(final String ascii) {
diff --git a/src/main/java/org/apache/commons/codec/binary/Hex.java
b/src/main/java/org/apache/commons/codec/binary/Hex.java
index 14582f62..422563d9 100644
--- a/src/main/java/org/apache/commons/codec/binary/Hex.java
+++ b/src/main/java/org/apache/commons/codec/binary/Hex.java
@@ -84,7 +84,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
* @param data An array of characters containing hexadecimal digits.
* @param out A byte array to contain the binary data decoded from the
supplied char array.
* @param outOffset The position within {@code out} to start writing the
decoded bytes.
- * @return the number of bytes written to {@code out}.
+ * @return The number of bytes written to {@code out}.
* @throws DecoderException Thrown if an odd number of characters or
illegal characters are supplied.
* @since 1.15
*/
@@ -203,7 +203,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
* @param toDigits the output alphabet (must contain at least 16 chars).
* @param out a char[] which will hold the resultant appropriate
characters from the alphabet.
* @param outOffset the position within {@code out} at which to start
writing the encoded characters.
- * @return the given {@code out}.
+ * @return The given {@code out}.
*/
private static char[] encodeHex(final byte[] data, final int dataOffset,
final int dataLen, final char[] toDigits, final char[] out, final int
outOffset) {
// two characters form the hex value.
@@ -336,7 +336,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
* {@link ByteBuffer#remaining()} will be used.
*
* @param byteBuffer the byte buffer.
- * @return the byte[].
+ * @return The byte[].
*/
private static byte[] toByteArray(final ByteBuffer byteBuffer) {
final int remaining = byteBuffer.remaining();
@@ -537,7 +537,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
/**
* Gets the charset.
*
- * @return the charset.
+ * @return The charset.
* @since 1.7
*/
public Charset getCharset() {
@@ -547,7 +547,7 @@ public class Hex implements BinaryEncoder, BinaryDecoder {
/**
* Gets the charset name.
*
- * @return the charset name.
+ * @return The charset name.
* @since 1.4
*/
public String getCharsetName() {
diff --git a/src/main/java/org/apache/commons/codec/binary/StringUtils.java
b/src/main/java/org/apache/commons/codec/binary/StringUtils.java
index 97e9fbf7..717a10c3 100644
--- a/src/main/java/org/apache/commons/codec/binary/StringUtils.java
+++ b/src/main/java/org/apache/commons/codec/binary/StringUtils.java
@@ -89,7 +89,7 @@ public class StringUtils {
* The string to encode (if null, return null).
* @param charset
* The {@link Charset} to encode the {@code String}.
- * @return the encoded bytes.
+ * @return The encoded bytes.
*/
private static ByteBuffer getByteBuffer(final String string, final Charset
charset) {
if (string == null) {
@@ -123,7 +123,7 @@ public class StringUtils {
* The string to encode (if null, return null).
* @param charset
* The {@link Charset} to encode the {@code String}.
- * @return the encoded bytes.
+ * @return The encoded bytes.
*/
private static byte[] getBytes(final String string, final Charset charset)
{
return string == null ? null : string.getBytes(charset);
@@ -158,7 +158,7 @@ public class StringUtils {
* @param string
* the String to encode, may be {@code null}.
* @param charsetName
- * The name of a required {@link java.nio.charset.Charset}.
+ * The name of a required {@link Charset}.
* @return encoded bytes, or {@code null} if the input string was {@code
null}.
* @throws IllegalStateException
* Thrown when a {@link UnsupportedEncodingException} is
caught, which should never happen for a
@@ -297,7 +297,7 @@ public class StringUtils {
* @param bytes
* The bytes to be decoded into characters, may be {@code null}.
* @param charsetName
- * The name of a required {@link java.nio.charset.Charset}.
+ * The name of a required {@link Charset}.
* @return A new {@code String} decoded from the specified array of bytes
using the given charset,
* or {@code null} if the input byte array was {@code null}.
* @throws IllegalStateException
diff --git a/src/main/java/org/apache/commons/codec/digest/Crypt.java
b/src/main/java/org/apache/commons/codec/digest/Crypt.java
index 15599c1f..30565548 100644
--- a/src/main/java/org/apache/commons/codec/digest/Crypt.java
+++ b/src/main/java/org/apache/commons/codec/digest/Crypt.java
@@ -17,6 +17,7 @@
package org.apache.commons.codec.digest;
import java.nio.charset.StandardCharsets;
+import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
/**
@@ -35,18 +36,15 @@ public class Crypt {
/**
* Encrypts a password in a crypt(3) compatible way.
* <p>
- * A random salt and the default algorithm (currently SHA-512) are used.
See {@link #crypt(String, String)} for
- * details.
+ * A random salt and the default algorithm (currently SHA-512) are used.
See {@link #crypt(String, String)} for details.
* </p>
* <p>
* A salt is generated for you using {@link SecureRandom}.
* </p>
*
- * @param keyBytes
- * plaintext password.
- * @return hash value.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext password.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String crypt(final byte[] keyBytes) {
return crypt(keyBytes, null);
@@ -55,22 +53,15 @@ public class Crypt {
/**
* Encrypts a password in a crypt(3) compatible way.
* <p>
- * If no salt is provided, a random salt and the default algorithm
(currently SHA-512) will be used. See
- * {@link #crypt(String, String)} for details.
+ * If no salt is provided, a random salt and the default algorithm
(currently SHA-512) will be used. See {@link #crypt(String, String)} for
details.
* </p>
*
- * @param keyBytes
- * plaintext password.
- * @param salt
- * the salt, which is used to select the algorithm, see {@link
#crypt(String, String)}
- * The salt may be null,
- * in which case the method delegates to {@link
Sha2Crypt#sha512Crypt(byte[])}.
- *
+ * @param keyBytes The plaintext password.
+ * @param salt The salt, which is used to select the algorithm, see
{@link #crypt(String, String)} The salt may be null, in which case the method
+ * delegates to {@link Sha2Crypt#sha512Crypt(byte[])}.
* @return hash value.
- * @throws IllegalArgumentException
- * if the salt does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String crypt(final byte[] keyBytes, final String salt) {
if (salt == null) {
@@ -98,11 +89,9 @@ public class Crypt {
* </p>
*
* @see #crypt(String, String)
- * @param key
- * plaintext password.
- * @return hash value.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param key The plaintext password.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String crypt(final String key) {
return crypt(key, null);
@@ -121,23 +110,21 @@ public class Crypt {
* <li>Only the first 8 chars of the passwords are used in the DES
algorithm!</li>
* </ul>
* <p>
- * The magic strings {@code "$apr1$"} and {@code "$2a$"} are not
recognized by this method as its output should be
- * identical with that of the libc implementation.
+ * The magic strings {@code "$apr1$"} and {@code "$2a$"} are not
recognized by this method as its output should be identical with that of the
libc
+ * implementation.
* </p>
* <p>
- * The rest of the salt string is drawn from the set {@code [a-zA-Z0-9./]}
and is cut at the maximum length or if a
- * {@code "$"} sign is encountered. It is therefore valid to enter a
complete hash value as salt to for example verify a
- * password with:
+ * The rest of the salt string is drawn from the set {@code [a-zA-Z0-9./]}
and is cut at the maximum length or if a {@code "$"} sign is encountered. It is
+ * therefore valid to enter a complete hash value as salt to for example
verify a password with:
* </p>
+ *
* <pre>
* storedPwd.equals(crypt(enteredPwd, storedPwd))
* </pre>
* <p>
- * The resulting string starts with the marker string ({@code $n$}), where
n is the same as the input salt.
- * The salt is then appended, followed by a {@code "$"} sign.
- * This is followed by the actual hash value.
- * For DES the string only contains the salt and actual hash.
- * The total length is dependent on the algorithm used:
+ * The resulting string starts with the marker string ({@code $n$}), where
n is the same as the input salt. The salt is then appended, followed by a
+ * {@code "$"} sign. This is followed by the actual hash value. For DES
the string only contains the salt and actual hash. The total length is
dependent on
+ * the algorithm used:
* </p>
* <ul>
* <li>SHA-512: 106 chars</li>
@@ -148,26 +135,22 @@ public class Crypt {
* <p>
* Example:
* </p>
+ *
* <pre>
* crypt("secret", "$1$xxxx") => "$1$xxxx$aMkevjfEIpa35Bh3G4bAc."
* crypt("secret", "xx") => "xxWAum7tHdIUw"
* </pre>
* <p>
- * This method comes in a variation that accepts a byte[] array to support
input strings that are not encoded in
- * UTF-8 but for example in ISO-8859-1 where equal characters result in
different byte values.
+ * This method comes in a variation that accepts a byte[] array to support
input strings that are not encoded in UTF-8 but for example in ISO-8859-1 where
+ * equal characters result in different byte values.
* </p>
*
* @see "The man page of the libc crypt (3) function."
- * @param key
- * plaintext password as entered by the used.
- * @param salt
- * real salt value without prefix or "rounds=". The salt may be
null, in which case a
- * salt is generated for you using {@link SecureRandom}.
- * @return hash value, i.e. encrypted password including the salt string.
- * @throws IllegalArgumentException
- * if the salt does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param key The plaintext password as entered by the used.
+ * @param salt The real salt value without prefix or "rounds=". The salt
may be null, in which case a salt is generated for you using {@link
SecureRandom}.
+ * @return The hash value, that is, the encrypted password including the
salt string.
+ * @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String crypt(final String key, final String salt) {
return crypt(key.getBytes(StandardCharsets.UTF_8), salt);
diff --git a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
index df91ea43..b1561348 100644
--- a/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
+++ b/src/main/java/org/apache/commons/codec/digest/DigestUtils.java
@@ -73,7 +73,7 @@ public class DigestUtils {
*
* @param messageDigest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @since 1.11
*/
public static byte[] digest(final MessageDigest messageDigest, final
byte[] data) {
@@ -85,7 +85,7 @@ public class DigestUtils {
*
* @param messageDigest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @since 1.11
*/
public static byte[] digest(final MessageDigest messageDigest, final
ByteBuffer data) {
@@ -98,7 +98,7 @@ public class DigestUtils {
*
* @param messageDigest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -111,7 +111,7 @@ public class DigestUtils {
*
* @param messageDigest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.11 (was private)
*/
@@ -125,7 +125,7 @@ public class DigestUtils {
* @param messageDigest The MessageDigest to use (for example MD5).
* @param data Data to digest.
* @param options options How to open the file.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.14
*/
@@ -138,7 +138,7 @@ public class DigestUtils {
*
* @param messageDigest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.14
*/
@@ -154,7 +154,7 @@ public class DigestUtils {
* Cryptography Architecture Reference Guide</a> for
information about standard algorithm names.
* @return A digest instance.
* @see MessageDigest#getInstance(String)
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static MessageDigest getDigest(final String algorithm) {
try {
@@ -173,7 +173,7 @@ public class DigestUtils {
* @param defaultMessageDigest The default MessageDigest.
* @return A digest instance.
* @see MessageDigest#getInstance(String)
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @since 1.11
*/
public static MessageDigest getDigest(final String algorithm, final
MessageDigest defaultMessageDigest) {
@@ -188,7 +188,7 @@ public class DigestUtils {
* Gets an MD2 MessageDigest.
*
* @return An MD2 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should never happen because MD2 is a
built-in algorithm.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should never happen because MD2 is a
built-in algorithm.
* @see MessageDigestAlgorithms#MD2
* @since 1.7
*/
@@ -200,7 +200,7 @@ public class DigestUtils {
* Gets an MD5 MessageDigest.
*
* @return An MD5 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should never happen because MD5 is a
built-in algorithm.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should never happen because MD5 is a
built-in algorithm.
* @see MessageDigestAlgorithms#MD5
*/
public static MessageDigest getMd5Digest() {
@@ -225,7 +225,7 @@ public class DigestUtils {
* Gets an SHA-1 digest.
*
* @return An SHA-1 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-1 is
a built-in algorithm.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-1 is
a built-in algorithm.
* @see MessageDigestAlgorithms#SHA_1
* @since 1.7
*/
@@ -237,7 +237,7 @@ public class DigestUtils {
* Gets an SHA-256 digest.
*
* @return An SHA-256 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-256
is a built-in algorithm.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-256
is a built-in algorithm.
* @see MessageDigestAlgorithms#SHA_256
*/
public static MessageDigest getSha256Digest() {
@@ -248,7 +248,7 @@ public class DigestUtils {
* Gets an SHA3-224 digest.
*
* @return An SHA3-224 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
* @see MessageDigestAlgorithms#SHA3_224
* @since 1.12
*/
@@ -260,7 +260,7 @@ public class DigestUtils {
* Returns an SHA3-256 digest.
*
* @return An SHA3-256 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
* @see MessageDigestAlgorithms#SHA3_256
* @since 1.12
*/
@@ -272,7 +272,7 @@ public class DigestUtils {
* Gets an SHA3-384 digest.
*
* @return An SHA3-384 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
* @see MessageDigestAlgorithms#SHA3_384
* @since 1.12
*/
@@ -284,7 +284,7 @@ public class DigestUtils {
* Gets an SHA3-512 digest.
*
* @return An SHA3-512 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 9
and greater.
* @see MessageDigestAlgorithms#SHA3_512
* @since 1.12
*/
@@ -296,7 +296,7 @@ public class DigestUtils {
* Gets an SHA-384 digest.
*
* @return An SHA-384 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-384
is a built-in algorithm.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-384
is a built-in algorithm.
* @see MessageDigestAlgorithms#SHA_384
*/
public static MessageDigest getSha384Digest() {
@@ -307,7 +307,7 @@ public class DigestUtils {
* Gets an SHA-512/224 digest.
*
* @return An SHA-512/224 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see MessageDigestAlgorithms#SHA_512_224
*/
public static MessageDigest getSha512_224Digest() {
@@ -318,7 +318,7 @@ public class DigestUtils {
* Gets an SHA-512/256 digest.
*
* @return An SHA-512/256 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see MessageDigestAlgorithms#SHA_512_224
*/
public static MessageDigest getSha512_256Digest() {
@@ -329,7 +329,7 @@ public class DigestUtils {
* Gets an SHA-512 digest.
*
* @return An SHA-512 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-512
is a built-in algorithm.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should never happen because SHA-512
is a built-in algorithm.
* @see MessageDigestAlgorithms#SHA_512
*/
public static MessageDigest getSha512Digest() {
@@ -340,7 +340,7 @@ public class DigestUtils {
* Gets an SHA-1 digest.
*
* @return An SHA-1 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @deprecated (1.11) Use {@link #getSha1Digest()}
*/
@Deprecated
@@ -352,7 +352,7 @@ public class DigestUtils {
* Gets an SHAKE128_256 digest.
*
* @return An SHAKE128_256 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 25
and greater.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 25
and greater.
* @see MessageDigestAlgorithms#SHAKE128_256
* @see <a
href="https://docs.oracle.com/en/java/javase/25/docs/specs/security/standard-names.html#messagedigest-algorithms">
Java 25 Cryptography
* Architecture Standard Algorithm Name Documentation</a>
@@ -368,7 +368,7 @@ public class DigestUtils {
* Gets an SHAKE128_512 digest.
*
* @return An SHAKE128_512 digest instance.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 25
and greater.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught, which should not happen on Oracle Java 25
and greater.
* @see MessageDigestAlgorithms#SHAKE256_512
* @see <a
href="https://docs.oracle.com/en/java/javase/25/docs/specs/security/standard-names.html#messagedigest-algorithms">
Java 25 Cryptography
* Architecture Standard Algorithm Name Documentation</a>
@@ -1422,7 +1422,7 @@ public class DigestUtils {
*
* @param messageDigest the {@link MessageDigest} to update.
* @param valueToDigest the value to update the {@link MessageDigest} with.
- * @return the updated {@link MessageDigest}.
+ * @return The updated {@link MessageDigest}.
* @since 1.7
*/
public static MessageDigest updateDigest(final MessageDigest
messageDigest, final byte[] valueToDigest) {
@@ -1435,7 +1435,7 @@ public class DigestUtils {
*
* @param messageDigest the {@link MessageDigest} to update.
* @param valueToDigest the value to update the {@link MessageDigest} with.
- * @return the updated {@link MessageDigest}.
+ * @return The updated {@link MessageDigest}.
* @since 1.11
*/
public static MessageDigest updateDigest(final MessageDigest
messageDigest, final ByteBuffer valueToDigest) {
@@ -1448,7 +1448,7 @@ public class DigestUtils {
*
* @param digest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -1463,7 +1463,7 @@ public class DigestUtils {
*
* @param digest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.14
*/
@@ -1482,7 +1482,7 @@ public class DigestUtils {
*
* @param digest The MessageDigest to use (for example MD5).
* @param inputStream Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.8
*/
@@ -1502,7 +1502,7 @@ public class DigestUtils {
* @param digest The MessageDigest to use (for example MD5).
* @param path Data to digest.
* @param options options How to open the file.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.14
*/
@@ -1517,7 +1517,7 @@ public class DigestUtils {
*
* @param digest The MessageDigest to use (for example MD5).
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.14
*/
@@ -1534,7 +1534,7 @@ public class DigestUtils {
*
* @param messageDigest the {@link MessageDigest} to update.
* @param valueToDigest the value to update the {@link MessageDigest}
with; converted to bytes using {@link StringUtils#getBytesUtf8(String)}.
- * @return the updated {@link MessageDigest}.
+ * @return The updated {@link MessageDigest}.
* @since 1.7
*/
public static MessageDigest updateDigest(final MessageDigest
messageDigest, final String valueToDigest) {
@@ -1573,7 +1573,7 @@ public class DigestUtils {
*
* @param name the name of the {@link MessageDigest} to use.
* @see #getDigest(String)
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @since 1.11
*/
public DigestUtils(final String name) {
@@ -1584,7 +1584,7 @@ public class DigestUtils {
* Reads through a byte array and returns the digest for the data.
*
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @since 1.11
*/
public byte[] digest(final byte[] data) {
@@ -1595,7 +1595,7 @@ public class DigestUtils {
* Reads through a ByteBuffer and returns the digest for the data
*
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @since 1.11
*/
public byte[] digest(final ByteBuffer data) {
@@ -1606,7 +1606,7 @@ public class DigestUtils {
* Reads through a File and returns the digest for the data
*
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -1618,7 +1618,7 @@ public class DigestUtils {
* Reads through an InputStream and returns the digest for the data
*
* @param data Data to digest.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -1631,7 +1631,7 @@ public class DigestUtils {
*
* @param data Data to digest.
* @param options options How to open the file.
- * @return the digest.
+ * @return The digest.
* @throws IOException On error reading from the stream.
* @since 1.14
*/
@@ -1643,7 +1643,7 @@ public class DigestUtils {
* Reads through a byte array and returns the digest for the data.
*
* @param data Data to digest treated as UTF-8 string.
- * @return the digest.
+ * @return The digest.
* @since 1.11
*/
public byte[] digest(final String data) {
@@ -1654,7 +1654,7 @@ public class DigestUtils {
* Reads through a byte array and returns the digest for the data.
*
* @param data Data to digest.
- * @return the digest as a hexadecimal string.
+ * @return The digest as a hexadecimal string.
* @since 1.11
*/
public String digestAsHex(final byte[] data) {
@@ -1665,7 +1665,7 @@ public class DigestUtils {
* Reads through a ByteBuffer and returns the digest for the data
*
* @param data Data to digest.
- * @return the digest as a hexadecimal string.
+ * @return The digest as a hexadecimal string.
* @since 1.11
*/
public String digestAsHex(final ByteBuffer data) {
@@ -1676,7 +1676,7 @@ public class DigestUtils {
* Reads through a File and returns the digest for the data
*
* @param data Data to digest.
- * @return the digest as a hexadecimal string.
+ * @return The digest as a hexadecimal string.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -1688,7 +1688,7 @@ public class DigestUtils {
* Reads through an InputStream and returns the digest for the data
*
* @param data Data to digest.
- * @return the digest as a hexadecimal string.
+ * @return The digest as a hexadecimal string.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -1701,7 +1701,7 @@ public class DigestUtils {
*
* @param data Data to digest.
* @param options options How to open the file.
- * @return the digest as a hexadecimal string.
+ * @return The digest as a hexadecimal string.
* @throws IOException On error reading from the stream.
* @since 1.11
*/
@@ -1713,7 +1713,7 @@ public class DigestUtils {
* Reads through a byte array and returns the digest for the data.
*
* @param data Data to digest treated as UTF-8 string.
- * @return the digest as a hexadecimal string.
+ * @return The digest as a hexadecimal string.
* @since 1.11
*/
public String digestAsHex(final String data) {
@@ -1723,7 +1723,7 @@ public class DigestUtils {
/**
* Returns the message digest instance.
*
- * @return the message digest instance.
+ * @return The message digest instance.
* @since 1.11
*/
public MessageDigest getMessageDigest() {
diff --git a/src/main/java/org/apache/commons/codec/digest/HmacAlgorithms.java
b/src/main/java/org/apache/commons/codec/digest/HmacAlgorithms.java
index 9ae48e51..7978d08e 100644
--- a/src/main/java/org/apache/commons/codec/digest/HmacAlgorithms.java
+++ b/src/main/java/org/apache/commons/codec/digest/HmacAlgorithms.java
@@ -92,7 +92,7 @@ public enum HmacAlgorithms {
/**
* Gets the algorithm name.
*
- * @return the algorithm name.
+ * @return The algorithm name.
* @since 1.11
*/
public String getName() {
diff --git a/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
b/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
index 4411b001..f245fe88 100644
--- a/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
+++ b/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
@@ -35,7 +35,7 @@ import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.binary.StringUtils;
/**
- * Simplifies common {@link javax.crypto.Mac} tasks. This class is immutable
and thread-safe. However the Mac may not be.
+ * Simplifies common {@link Mac} tasks. This class is immutable and
thread-safe. However the Mac may not be.
* <p>
* <strong>Note: Not all JCE implementations support all algorithms. If not
supported, an IllegalArgumentException is thrown.</strong>
* </p>
@@ -61,14 +61,14 @@ public final class HmacUtils {
private static final int STREAM_BUFFER_LENGTH = 1024;
/**
- * Returns an initialized {@code Mac} for the HmacMD5 algorithm.
+ * Returns an initialized {@link Mac} for the HmacMD5 algorithm.
* <p>
* Every implementation of the Java platform is required to support this
standard Mac algorithm.
* </p>
*
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
* @deprecated (1.11) Use {@code
getInitializedMac(HmacAlgorithms.HMAC_MD5, byte[])}.
@@ -79,14 +79,14 @@ public final class HmacUtils {
}
/**
- * Returns an initialized {@code Mac} for the HmacSHA1 algorithm.
+ * Returns an initialized {@link Mac} for the HmacSHA1 algorithm.
* <p>
* Every implementation of the Java platform is required to support this
standard Mac algorithm.
* </p>
*
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
* @deprecated (1.11) Use {@code
getInitializedMac(HmacAlgorithms.HMAC_SHA_1, byte[])}.
@@ -97,14 +97,14 @@ public final class HmacUtils {
}
/**
- * Returns an initialized {@code Mac} for the HmacSHA256 algorithm.
+ * Returns an initialized {@link Mac} for the HmacSHA256 algorithm.
* <p>
* Every implementation of the Java platform is required to support this
standard Mac algorithm.
* </p>
*
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
* @deprecated (1.11) Use {@code
getInitializedMac(HmacAlgorithms.HMAC_SHA_256, byte[])}.
@@ -115,14 +115,14 @@ public final class HmacUtils {
}
/**
- * Returns an initialized {@code Mac} for the HmacSHA384 algorithm.
+ * Returns an initialized {@link Mac} for the HmacSHA384 algorithm.
* <p>
* Every implementation of the Java platform is <em>not</em> required to
support this Mac algorithm.
* </p>
*
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
* @deprecated (1.11) Use {@code
getInitializedMac(HmacAlgorithms.HMAC_SHA_384, byte[])}.
@@ -133,14 +133,14 @@ public final class HmacUtils {
}
/**
- * Returns an initialized {@code Mac} for the HmacSHA512 algorithm.
+ * Returns an initialized {@link Mac} for the HmacSHA512 algorithm.
* <p>
* Every implementation of the Java platform is <em>not</em> required to
support this Mac algorithm.
* </p>
*
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
* @deprecated (1.11) Use {@code
getInitializedMac(HmacAlgorithms.HMAC_SHA_512, byte[])}.
@@ -151,14 +151,14 @@ public final class HmacUtils {
}
/**
- * Returns an initialized {@code Mac} for the given {@code algorithm}.
+ * Returns an initialized {@link Mac} for the given {@code algorithm}.
*
* @param algorithm the name of the algorithm requested. See
* <a href=
"https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA"
>Appendix A in the Java
* Cryptography Architecture Reference Guide</a> for
information about standard algorithm names.
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
*/
@@ -167,14 +167,14 @@ public final class HmacUtils {
}
/**
- * Returns an initialized {@code Mac} for the given {@code algorithm}.
+ * Returns an initialized {@link Mac} for the given {@code algorithm}.
*
* @param algorithm the name of the algorithm requested. See
* <a href=
"https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html#AppA"
>Appendix A in the Java
* Cryptography Architecture Reference Guide</a> for
information about standard algorithm names.
* @param key The key for the keyed digest (must not be null).
* @return A Mac instance initialized with the given key.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
*/
@@ -198,7 +198,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacMD5 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_MD5,
byte[]).hmac(byte[])}.
*/
@Deprecated
@@ -210,13 +210,11 @@ public final class HmacUtils {
* Returns a HmacMD5 Message Authentication Code (MAC) for the given key
and value.
*
* @param key The key for the keyed digest (must not be null).
- * @param valueToDigest The value (data) which should to digest
- * <p>
+ * @param valueToDigest The value (data) which should to digest.
* The InputStream must not be null and will not be
closed.
- * </p>
* @return HmacMD5 MAC for the given key and value.
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_MD5,
byte[]).hmac(InputStream)}.
*/
@Deprecated
@@ -230,7 +228,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacMD5 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_MD5,
String).hmac(String)}.
*/
@Deprecated
@@ -244,7 +242,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacMD5 MAC for the given key and value as a hexadecimal string
(lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_MD5,
byte[]).hmacHex(byte[])}.
*/
@Deprecated
@@ -256,13 +254,11 @@ public final class HmacUtils {
* Returns a HmacMD5 Message Authentication Code (MAC) as a hexadecimal
string (lowercase) for the given key and value.
*
* @param key The key for the keyed digest (must not be null).
- * @param valueToDigest The value (data) which should to digest
- * <p>
+ * @param valueToDigest The value (data) which should to digest.
* The InputStream must not be null and will not be
closed.
- * </p>
* @return HmacMD5 MAC for the given key and value as a hexadecimal string
(lowercase).
- * @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IOException Thrown if an I/O error occurs.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_MD5,
byte[]).hmacHex(InputStream)}.
*/
@Deprecated
@@ -276,7 +272,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacMD5 MAC for the given key and value as a hexadecimal string
(lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_MD5,
String).hmacHex(String)}.
*/
@Deprecated
@@ -290,7 +286,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA1 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_SHA_1,
byte[]).hmac(byte[])}.
*/
@Deprecated
@@ -302,13 +298,11 @@ public final class HmacUtils {
* Returns a HmacSHA1 Message Authentication Code (MAC) for the given key
and value.
*
* @param key The key for the keyed digest (must not be null).
- * @param valueToDigest The value (data) which should to digest
- * <p>
+ * @param valueToDigest The value (data) which should to digest.
* The InputStream must not be null and will not be
closed.
- * </p>
* @return HmacSHA1 MAC for the given key and value.
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_SHA_1,
byte[]).hmac(InputStream)}.
*/
@Deprecated
@@ -322,7 +316,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA1 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_SHA_1,
String).hmac(String)}.
*/
@Deprecated
@@ -336,7 +330,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA1 MAC for the given key and value as hexadecimal string
(lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_SHA_1,
byte[]).hmacHex(byte[])}
*/
@Deprecated
@@ -349,12 +343,10 @@ public final class HmacUtils {
*
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest.
- * <p>
* The InputStream must not be null and will not be
closed.
- * </p>
* @return HmacSHA1 MAC for the given key and value as hexadecimal string
(lowercase).
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_SHA_1,
byte[]).hmacHex(InputStream)}.
*/
@Deprecated
@@ -368,7 +360,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA1 MAC for the given key and value as hexadecimal string
(lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new HmacUtils(HmacAlgorithms.HMAC_SHA_1,
String).hmacHex(String)}.
*/
@Deprecated
@@ -382,7 +374,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA256 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_256, byte[]).hmac(byte[])}.
*/
@Deprecated
@@ -394,13 +386,10 @@ public final class HmacUtils {
* Returns a HmacSHA256 Message Authentication Code (MAC) for the given
key and value.
*
* @param key The key for the keyed digest (must not be null).
- * @param valueToDigest The value (data) which should to digest.
- * <p>
- * The InputStream must not be null and will not be
closed.
- * </p>
+ * @param valueToDigest The value (data) which should to digest. The
InputStream must not be null and will not be closed.
* @return HmacSHA256 MAC for the given key and value.
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_256, byte[]).hmac(InputStream)}.
*/
@Deprecated
@@ -414,7 +403,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA256 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_256, String).hmac(String)}.
*/
@Deprecated
@@ -428,7 +417,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA256 MAC for the given key and value as hexadecimal
string (lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_256, byte[]).hmacHex(byte[])}.
*/
@Deprecated
@@ -446,7 +435,7 @@ public final class HmacUtils {
* </p>
* @return HmacSHA256 MAC for the given key and value as hexadecimal
string (lowercase).
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_256, byte[]).hmacHex(InputStream)}.
*/
@Deprecated
@@ -460,7 +449,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA256 MAC for the given key and value as hexadecimal
string (lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_256, String).hmacHex(String)}.
*/
@Deprecated
@@ -474,7 +463,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA384 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_384, byte[]).hmac(byte[])}.
*/
@Deprecated
@@ -492,7 +481,7 @@ public final class HmacUtils {
* </p>
* @return HmacSHA384 MAC for the given key and value.
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_384, byte[]).hmac(InputStream)}.
*/
@Deprecated
@@ -506,7 +495,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA384 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_384, String).hmac(String)}.
*/
@Deprecated
@@ -521,7 +510,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA384 MAC for the given key and value as hexadecimal
string (lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_384, byte[]).hmacHex(byte[])}.
*/
@Deprecated
@@ -539,7 +528,7 @@ public final class HmacUtils {
* </p>
* @return HmacSHA384 MAC for the given key and value as hexadecimal
string (lowercase).
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_384, byte[]).hmacHex(InputStream)}.
*/
@Deprecated
@@ -553,7 +542,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA384 MAC for the given key and value as hexadecimal
string (lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_384, String).hmacHex(String)}.
*/
@Deprecated
@@ -567,7 +556,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA512 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_512, byte[]).hmac(byte[])}.
*/
@Deprecated
@@ -585,7 +574,7 @@ public final class HmacUtils {
* </p>
* @return HmacSHA512 MAC for the given key and value.
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_512, byte[]).hmac(InputStream)}.
*/
@Deprecated
@@ -599,7 +588,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA512 MAC for the given key and value.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_512, String).hmac(String)}.
*/
@Deprecated
@@ -614,7 +603,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA512 MAC for the given key and value as hexadecimal
string (lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_512, byte[]).hmacHex(byte[])}.
*/
@Deprecated
@@ -632,7 +621,7 @@ public final class HmacUtils {
* </p>
* @return HmacSHA512 MAC for the given key and value as hexadecimal
string (lowercase).
* @throws IOException If an I/O error occurs.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_512, byte[]).hmacHex(InputStream)}.
*/
@Deprecated
@@ -646,7 +635,7 @@ public final class HmacUtils {
* @param key The key for the keyed digest (must not be null).
* @param valueToDigest The value (data) which should to digest (maybe
empty or null).
* @return HmacSHA512 MAC for the given key and value as hexadecimal
string (lowercase).
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @deprecated (1.11) Use {@code new
HmacUtils(HmacAlgorithms.HMAC_SHA_512, String).hmacHex(String)}.
*/
@Deprecated
@@ -686,7 +675,7 @@ public final class HmacUtils {
*
* @param mac the initialized {@link Mac} to update.
* @param valueToDigest the value to update the {@link Mac} with (maybe
null or empty).
- * @return the updated {@link Mac}.
+ * @return The updated {@link Mac}.
* @throws IllegalStateException if the Mac was not initialized.
*/
public static Mac updateHmac(final Mac mac, final byte[] valueToDigest) {
@@ -703,7 +692,7 @@ public final class HmacUtils {
* <p>
* The InputStream must not be null and will not be
closed.
* </p>
- * @return the updated {@link Mac}.
+ * @return The updated {@link Mac}.
* @throws IOException If an I/O error occurs.
* @throws IllegalStateException If the Mac was not initialized.
*/
@@ -723,7 +712,7 @@ public final class HmacUtils {
*
* @param mac the initialized {@link Mac} to update.
* @param valueToDigest the value to update the {@link Mac} with (maybe
null or empty).
- * @return the updated {@link Mac}.
+ * @return The updated {@link Mac}.
* @throws IllegalStateException if the Mac was not initialized.
*/
public static Mac updateHmac(final Mac mac, final String valueToDigest) {
@@ -749,7 +738,7 @@ public final class HmacUtils {
*
* @param algorithm to use.
* @param key the key to use.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @since 1.11
*/
public HmacUtils(final HmacAlgorithms algorithm, final byte[] key) {
@@ -761,7 +750,7 @@ public final class HmacUtils {
*
* @param algorithm to use.
* @param key the key to use.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @since 1.11
*/
public HmacUtils(final HmacAlgorithms algorithm, final String key) {
@@ -777,7 +766,7 @@ public final class HmacUtils {
*
* @param algorithm to use.
* @param key the key to use.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @since 1.11
*/
public HmacUtils(final String algorithm, final byte[] key) {
@@ -789,7 +778,7 @@ public final class HmacUtils {
*
* @param algorithm to use.
* @param key the key to use.
- * @throws IllegalArgumentException when a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught or key is null or key is invalid.
* @since 1.11
*/
public HmacUtils(final String algorithm, final String key) {
@@ -800,7 +789,7 @@ public final class HmacUtils {
* Returns the digest for the input data.
*
* @param valueToDigest the input to use.
- * @return the digest as a byte[].
+ * @return The digest as a byte[].
* @since 1.11
*/
public byte[] hmac(final byte[] valueToDigest) {
@@ -811,7 +800,7 @@ public final class HmacUtils {
* Returns the digest for the input data.
*
* @param valueToDigest the input to use.
- * @return the digest as a byte[].
+ * @return The digest as a byte[].
* @since 1.11
*/
public byte[] hmac(final ByteBuffer valueToDigest) {
@@ -823,7 +812,7 @@ public final class HmacUtils {
* Returns the digest for the file.
*
* @param valueToDigest the file to use.
- * @return the digest.
+ * @return The digest.
* @throws IOException If an I/O error occurs.
* @since 1.11
*/
@@ -838,7 +827,7 @@ public final class HmacUtils {
* <p>
* The InputStream must not be null and will not be
closed.
* </p>
- * @return the digest.
+ * @return The digest.
* @throws IOException If an I/O error occurs.
* @since 1.11
*/
@@ -855,7 +844,7 @@ public final class HmacUtils {
* Returns the digest for the file.
*
* @param valueToDigest the path to use.
- * @return the digest.
+ * @return The digest.
* @throws IOException If an I/O error occurs.
* @since 1.19.0
*/
@@ -869,7 +858,7 @@ public final class HmacUtils {
* Returns the digest for the input data.
*
* @param valueToDigest the input to use, treated as UTF-8.
- * @return the digest as a byte[].
+ * @return The digest as a byte[].
* @since 1.11
*/
public byte[] hmac(final String valueToDigest) {
@@ -880,7 +869,7 @@ public final class HmacUtils {
* Returns the digest for the input data.
*
* @param valueToDigest the input to use.
- * @return the digest as a hexadecimal String.
+ * @return The digest as a hexadecimal String.
* @since 1.11
*/
public String hmacHex(final byte[] valueToDigest) {
@@ -891,7 +880,7 @@ public final class HmacUtils {
* Returns the digest for the input data.
*
* @param valueToDigest the input to use.
- * @return the digest as a hexadecimal String.
+ * @return The digest as a hexadecimal String.
* @since 1.11
*/
public String hmacHex(final ByteBuffer valueToDigest) {
@@ -902,7 +891,7 @@ public final class HmacUtils {
* Returns the digest for the file.
*
* @param valueToDigest the file to use.
- * @return the digest as a hexadecimal String.
+ * @return The digest as a hexadecimal String.
* @throws IOException If an I/O error occurs.
* @since 1.11
*/
@@ -917,7 +906,7 @@ public final class HmacUtils {
* <p>
* The InputStream must not be null and will not be
closed.
* </p>
- * @return the digest as a hexadecimal String.
+ * @return The digest as a hexadecimal String.
* @throws IOException If an I/O error occurs.
* @since 1.11
*/
@@ -929,7 +918,7 @@ public final class HmacUtils {
* Returns the digest for the path.
*
* @param valueToDigest the path to use.
- * @return the digest as a hexadecimal String.
+ * @return The digest as a hexadecimal String.
* @throws IOException If an I/O error occurs.
* @since 1.19.0
*/
@@ -941,7 +930,7 @@ public final class HmacUtils {
* Returns the digest for the input data.
*
* @param valueToDigest the input to use, treated as UTF-8.
- * @return the digest as a hexadecimal String.
+ * @return The digest as a hexadecimal String.
* @since 1.11
*/
public String hmacHex(final String valueToDigest) {
diff --git a/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java
b/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java
index 01c5b13c..e62ecefe 100644
--- a/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java
+++ b/src/main/java/org/apache/commons/codec/digest/Md5Crypt.java
@@ -14,10 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.apache.commons.codec.digest;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.Objects;
@@ -28,13 +30,13 @@ import java.util.regex.Pattern;
/**
* The libc crypt() "$1$" and Apache "$apr1$" MD5-based hash algorithm.
* <p>
- * Based on the public domain ("beer-ware") C implementation from Poul-Henning
Kamp which was found at: <a
- *
href="https://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libcrypt/crypt-md5.c?rev=1.1;content-type=text%2Fplain">
- * crypt-md5.c @ freebsd.org</a>
+ * Based on the public domain ("beer-ware") C implementation from Poul-Henning
Kamp which was found at:
+ * <a
href="https://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libcrypt/crypt-md5.c?rev=1.1;content-type=text%2Fplain">
crypt-md5.c @ freebsd.org</a>
* </p>
* <p>
* Source:
* </p>
+ *
* <pre>
* $FreeBSD: src/lib/libcrypt/crypt-md5.c,v 1.1 1999/01/21 13:50:09 brandon
Exp $
* </pre>
@@ -67,13 +69,12 @@ public class Md5Crypt {
/**
* See {@link #apr1Crypt(byte[], String)} for details.
* <p>
- * A salt is generated for you using {@link SecureRandom}; your own {@link
Random} in
- * {@link #apr1Crypt(byte[], Random)}.
+ * A salt is generated for you using {@link SecureRandom}; your own {@link
Random} in {@link #apr1Crypt(byte[], Random)}.
* </p>
*
- * @param keyBytes plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @return the hash value.
- * @throws IllegalArgumentException when a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see #apr1Crypt(byte[], String)
*/
public static String apr1Crypt(final byte[] keyBytes) {
@@ -86,11 +87,10 @@ public class Md5Crypt {
* A salt is generated for you using the user provided {@link Random}.
* </p>
*
- * @param keyBytes plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param random the instance of {@link Random} to use for generating the
salt.
- * Consider using {@link SecureRandom} for more secure salts.
- * @return the hash value.
- * @throws IllegalArgumentException when a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @param random The instance of {@link Random} to use for generating
the salt. Consider using {@link SecureRandom} for more secure salts.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see #apr1Crypt(byte[], String)
* @since 1.12
*/
@@ -104,16 +104,11 @@ public class Md5Crypt {
* A salt is generated for you using {@link SecureRandom}
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param salt
- * An APR1 salt. The salt may be null, in which case a salt is
generated for you using
- * {@link SecureRandom}.
- * @return the hash value.
- * @throws IllegalArgumentException
- * if the salt does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @param salt An APR1 salt. The salt may be null, in which case a
salt is generated for you using {@link SecureRandom}.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String apr1Crypt(final byte[] keyBytes, String salt) {
// to make the md5Crypt regex happy
@@ -129,11 +124,9 @@ public class Md5Crypt {
* A salt is generated for you using {@link SecureRandom}.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @return the hash value.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext string to hash. Each array element is set
to {@code 0} before returning.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see #apr1Crypt(byte[], String)
*/
public static String apr1Crypt(final String keyBytes) {
@@ -143,20 +136,15 @@ public class Md5Crypt {
/**
* Generates an Apache htpasswd compatible "$apr1$" MD5 based hash value.
* <p>
- * The algorithm is identical to the crypt(3) "$1$" one but produces
different outputs due to the different salt
- * prefix.
+ * The algorithm is identical to the crypt(3) "$1$" one but produces
different outputs due to the different salt prefix.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param salt
- * salt string including the prefix and optionally garbage at
the end. The salt may be null, in which
- * case a salt is generated for you using {@link SecureRandom}.
- * @return the hash value.
- * @throws IllegalArgumentException
- * if the salt does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext string to hash. Each array element is set
to {@code 0} before returning.
+ * @param salt salt string including the prefix and optionally garbage
at the end. The salt may be null, in which case a salt is generated for you
using
+ * {@link SecureRandom}.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String apr1Crypt(final String keyBytes, final String salt) {
return apr1Crypt(keyBytes.getBytes(StandardCharsets.UTF_8), salt);
@@ -171,11 +159,9 @@ public class Md5Crypt {
* A salt is generated for you using {@link SecureRandom}.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @return the hash value.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see #md5Crypt(byte[], String)
*/
public static String md5Crypt(final byte[] keyBytes) {
@@ -191,14 +177,10 @@ public class Md5Crypt {
* A salt is generated for you using the instance of {@link Random} you
supply.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param random
- * the instance of {@link Random} to use for generating the
salt.
- * Consider using {@link SecureRandom} for more secure salts.
- * @return the hash value.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @param random The instance of {@link Random} to use for generating
the salt. Consider using {@link SecureRandom} for more secure salts.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @see #md5Crypt(byte[], String)
* @since 1.12
*/
@@ -209,20 +191,15 @@ public class Md5Crypt {
/**
* Generates a libc crypt() compatible "$1$" MD5 based hash value.
* <p>
- * See {@link Crypt#crypt(String, String)} for details. We use {@link
SecureRandom} for seed generation by
- * default.
+ * See {@link Crypt#crypt(String, String)} for details. We use {@link
SecureRandom} for seed generation by default.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param salt
- * salt string including the prefix and optionally garbage at
the end. The salt may be null, in which
- * case a salt is generated for you using {@link SecureRandom}.
- * @return the hash value.
- * @throws IllegalArgumentException
- * if the salt does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @param salt salt string including the prefix and optionally garbage
at the end. The salt may be null, in which case a salt is generated for you
using
+ * {@link SecureRandom}.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String md5Crypt(final byte[] keyBytes, final String salt) {
return md5Crypt(keyBytes, salt, MD5_PREFIX);
@@ -231,22 +208,15 @@ public class Md5Crypt {
/**
* Generates a libc6 crypt() "$1$" or Apache htpasswd "$apr1$" hash value.
* <p>
- * See {@link Crypt#crypt(String, String)} or {@link #apr1Crypt(String,
String)} for details. We use
- * {@link SecureRandom by default}.
+ * See {@link Crypt#crypt(String, String)} or {@link #apr1Crypt(String,
String)} for details. We use {@link SecureRandom by default}.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param salt
- * real salt value without prefix or "rounds=". The salt may be
null, in which case a salt
- * is generated for you using {@link SecureRandom}.
- * @param prefix
- * The salt prefix {@value #APR1_PREFIX}, {@value #MD5_PREFIX}.
- * @return the hash value.
- * @throws IllegalArgumentException
- * if the salt does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @param salt The real salt value without prefix or "rounds=". The
salt may be null, in which case a salt is generated for you using {@link
SecureRandom}.
+ * @param prefix The salt prefix {@value #APR1_PREFIX}, {@value
#MD5_PREFIX}.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String md5Crypt(final byte[] keyBytes, final String salt,
final String prefix) {
return md5Crypt(keyBytes, salt, prefix, new SecureRandom());
@@ -258,36 +228,24 @@ public class Md5Crypt {
* See {@link Crypt#crypt(String, String)} or {@link #apr1Crypt(String,
String)} for details.
* </p>
*
- * @param keyBytes
- * plaintext string to hash. Each array element is set to
{@code 0} before returning.
- * @param salt
- * real salt value without prefix or "rounds=". The salt may be
null, in which case a salt
- * is generated for you using {@link SecureRandom}.
- * @param prefix
- * The salt prefix {@value #APR1_PREFIX}, {@value #MD5_PREFIX}.
- * @param random
- * the instance of {@link Random} to use for generating the
salt.
- * Consider using {@link SecureRandom} for more secure salts.
- * @return the hash value.
- * @throws IllegalArgumentException
- * if the salt or prefix does not match the allowed pattern.
- * @throws IllegalArgumentException
- * when a {@link java.security.NoSuchAlgorithmException} is
caught.
+ * @param keyBytes The plaintext bytes to hash. Each array element is set
to {@code 0} before returning.
+ * @param salt The real salt value without prefix or "rounds=". The
salt may be null, in which case a salt is generated for you using {@link
SecureRandom}.
+ * @param prefix The salt prefix {@value #APR1_PREFIX}, {@value
#MD5_PREFIX}.
+ * @param random The instance of {@link Random} to use for generating
the salt. Consider using {@link SecureRandom} for more secure salts.
+ * @return The hash value.
+ * @throws IllegalArgumentException Thrown if the salt or prefix does not
match the allowed pattern.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @since 1.12
*/
public static String md5Crypt(final byte[] keyBytes, final String salt,
final String prefix, final Random random) {
final int keyLen = keyBytes.length;
-
// Extract the real salt from the given string which can be a complete
hash string.
final String saltString;
if (salt == null) {
saltString = B64.getRandomSalt(8, random);
} else {
Objects.requireNonNull(prefix, "prefix");
- if (prefix.length() < 3) {
- throw new IllegalArgumentException("Invalid prefix value: " +
prefix);
- }
- if (prefix.charAt(0) != '$' && prefix.charAt(prefix.length() - 1)
!= '$') {
+ if (prefix.length() < 3 || prefix.charAt(0) != '$' &&
prefix.charAt(prefix.length() - 1) != '$') {
throw new IllegalArgumentException("Invalid prefix value: " +
prefix);
}
final Pattern p = Pattern.compile("^" + prefix.replace("$", "\\$")
+ "([\\.\\/a-zA-Z0-9]{1,8}).*");
@@ -298,24 +256,19 @@ public class Md5Crypt {
saltString = m.group(1);
}
final byte[] saltBytes = saltString.getBytes(StandardCharsets.UTF_8);
-
final MessageDigest messageDigestMd5 = DigestUtils.getMd5Digest();
-
/*
- * The password first, since that is what is most unknown
+ The password first, since that is what is most unknown
*/
messageDigestMd5.update(keyBytes);
-
/*
* Then our magic string
*/
messageDigestMd5.update(prefix.getBytes(StandardCharsets.UTF_8));
-
/*
* Then the raw salt
*/
messageDigestMd5.update(saltBytes);
-
/*
* Then just as many characters of the MD5(pw,salt,pw)
*/
@@ -329,12 +282,10 @@ public class Md5Crypt {
messageDigestMd5.update(finalb, 0, Math.min(ii, 16));
ii -= 16;
}
-
/*
* Don't leave anything around in JVM they could use.
*/
Arrays.fill(finalb, (byte) 0);
-
/*
* Then something really weird...
*/
@@ -348,16 +299,14 @@ public class Md5Crypt {
}
ii >>= 1;
}
-
/*
* Now make the output string
*/
final StringBuilder passwd = new StringBuilder(prefix + saltString +
"$");
finalb = messageDigestMd5.digest();
-
/*
- * and now, just to make sure things don't run too fast On a 60 Mhz
Pentium this takes 34 milliseconds, so you
- * would need 30 seconds to build a 1000 entry dictionary...
+ * and now, just to make sure things don't run too fast On a 60 Mhz
Pentium this takes 34 milliseconds, so you would need 30 seconds to build a 1000
+ * entry dictionary...
*/
for (int i = 0; i < ROUNDS; i++) {
altMessageDigestMd5 = DigestUtils.getMd5Digest();
@@ -366,15 +315,12 @@ public class Md5Crypt {
} else {
altMessageDigestMd5.update(finalb, 0, BLOCKSIZE);
}
-
if (i % 3 != 0) {
altMessageDigestMd5.update(saltBytes);
}
-
if (i % 7 != 0) {
altMessageDigestMd5.update(keyBytes);
}
-
if ((i & 1) != 0) {
altMessageDigestMd5.update(finalb, 0, BLOCKSIZE);
} else {
@@ -382,7 +328,6 @@ public class Md5Crypt {
}
finalb = altMessageDigestMd5.digest();
}
-
// The following was nearly identical to the Sha2Crypt code.
// Again, the buflen is not really needed.
// int buflen = MD5_PREFIX.length() - 1 + salt_string.length() + 1 +
BLOCKSIZE + 1;
@@ -392,7 +337,6 @@ public class Md5Crypt {
B64.b64from24bit(finalb[3], finalb[9], finalb[15], 4, passwd);
B64.b64from24bit(finalb[4], finalb[10], finalb[5], 4, passwd);
B64.b64from24bit((byte) 0, (byte) 0, finalb[11], 2, passwd);
-
/*
* Don't leave anything around in JVM they could use.
*/
@@ -402,7 +346,6 @@ public class Md5Crypt {
Arrays.fill(keyBytes, (byte) 0);
Arrays.fill(saltBytes, (byte) 0);
Arrays.fill(finalb, (byte) 0);
-
return passwd.toString();
}
diff --git a/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java
b/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java
index 21b92337..7c758de2 100644
--- a/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java
+++ b/src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java
@@ -83,7 +83,7 @@ public class Sha2Crypt {
*
* @param keyBytes Plaintext to hash. Each array element is set to {@code
0} before returning.
* @return The Complete hash value.
- * @throws IllegalArgumentException Thrown if a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String sha256Crypt(final byte[] keyBytes) {
return sha256Crypt(keyBytes, null);
@@ -100,7 +100,7 @@ public class Sha2Crypt {
* If one does not want to use {@link SecureRandom}, you
can pass your own {@link Random} in {@link #sha256Crypt(byte[], String,
Random)}.
* @return The Complete hash value including salt.
* @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
- * @throws IllegalArgumentException Thrown if a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String sha256Crypt(final byte[] keyBytes, String salt) {
if (salt == null) {
@@ -120,7 +120,7 @@ public class Sha2Crypt {
* @param random the instance of {@link Random} to use for generating
the salt. Consider using {@link SecureRandom} for more secure salts.
* @return The Complete hash value including salt.
* @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
- * @throws IllegalArgumentException Thrown if a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @since 1.12
*/
public static String sha256Crypt(final byte[] keyBytes, String salt, final
Random random) {
@@ -538,7 +538,7 @@ public class Sha2Crypt {
*
* @param keyBytes Plaintext to hash. Each array element is set to {@code
0} before returning.
* @return Complete hash value.
- * @throws IllegalArgumentException Thrown if a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String sha512Crypt(final byte[] keyBytes) {
return sha512Crypt(keyBytes, null);
@@ -557,7 +557,7 @@ public class Sha2Crypt {
* {@link #sha512Crypt(byte[], String, Random)}.
* @return Complete hash value including salt.
* @throws IllegalArgumentException Thrown if the salt does not match the
allowed pattern.
- * @throws IllegalArgumentException Thrown if a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
*/
public static String sha512Crypt(final byte[] keyBytes, String salt) {
if (salt == null) {
@@ -578,7 +578,7 @@ public class Sha2Crypt {
* @param random The instance of {@link Random} to use for generating
the salt. Consider using {@link SecureRandom} for more secure salts.
* @return Complete hash value including salt.
* @throws IllegalArgumentException if the salt does not match the allowed
pattern.
- * @throws IllegalArgumentException when a {@link
java.security.NoSuchAlgorithmException} is caught.
+ * @throws IllegalArgumentException Thrown if a {@link
NoSuchAlgorithmException} is caught.
* @since 1.12
*/
public static String sha512Crypt(final byte[] keyBytes, String salt, final
Random random) {
diff --git
a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
index 2655c7ba..93c6c65e 100644
--- a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
+++ b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
@@ -322,7 +322,7 @@ public class ColognePhonetic implements StringEncoder {
* </p>
*
* @param text The source text to encode.
- * @return the corresponding encoding according to the <em>Kölner
Phonetik</em> algorithm.
+ * @return The corresponding encoding according to the <em>Kölner
Phonetik</em> algorithm.
*/
public String colognePhonetic(final String text) {
if (text == null) {
diff --git
a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
index 5a360e14..262d7536 100644
--- a/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
@@ -152,7 +152,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Gets the alternate string.
*
- * @return the alternate string.
+ * @return The alternate string.
*/
public String getAlternate() {
return alternate.toString();
@@ -161,7 +161,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Gets the primary string.
*
- * @return the primary string.
+ * @return The primary string.
*/
public String getPrimary() {
return primary.toString();
@@ -478,7 +478,7 @@ public class DoubleMetaphone implements StringEncoder {
/**
* Gets the maxCodeLen.
*
- * @return the maxCodeLen.
+ * @return The maxCodeLen.
*/
public int getMaxCodeLen() {
return maxCodeLen;
diff --git
a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java
b/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java
index 1ae00c3a..75f37c68 100644
---
a/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java
+++
b/src/main/java/org/apache/commons/codec/language/MatchRatingApproachEncoder.java
@@ -297,7 +297,7 @@ public class MatchRatingApproachEncoder implements
StringEncoder {
*
* @param name1 first name.
* @param name1 second name.
- * @return the length as above.
+ * @return The length as above.
*/
int leftToRightThenRightToLeftProcessing(final String name1, final String
name2) {
final char[] name1Char = name1.toCharArray();
diff --git a/src/main/java/org/apache/commons/codec/language/Metaphone.java
b/src/main/java/org/apache/commons/codec/language/Metaphone.java
index 429bc2a9..eefecfe6 100644
--- a/src/main/java/org/apache/commons/codec/language/Metaphone.java
+++ b/src/main/java/org/apache/commons/codec/language/Metaphone.java
@@ -113,7 +113,7 @@ public class Metaphone implements StringEncoder {
/**
* Gets the maxCodeLen.
*
- * @return the maxCodeLen.
+ * @return The maxCodeLen.
*/
public int getMaxCodeLen() {
return this.maxCodeLen;
diff --git a/src/main/java/org/apache/commons/codec/language/Soundex.java
b/src/main/java/org/apache/commons/codec/language/Soundex.java
index e7c19ee9..142f8d99 100644
--- a/src/main/java/org/apache/commons/codec/language/Soundex.java
+++ b/src/main/java/org/apache/commons/codec/language/Soundex.java
@@ -224,7 +224,7 @@ public class Soundex implements StringEncoder {
/**
* Returns the maxLength. Standard Soundex
*
- * @return the maxLength.
+ * @return The maxLength.
* @deprecated This feature is not needed since the encoding size must be
constant. Will be removed in 2.0.
*/
@Deprecated
diff --git
a/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java
b/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java
index 9bea5c4c..58043771 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/BeiderMorseEncoder.java
@@ -113,7 +113,7 @@ public class BeiderMorseEncoder implements StringEncoder {
/**
* Gets the name type currently in operation.
*
- * @return the NameType currently being used.
+ * @return The NameType currently being used.
*/
public NameType getNameType() {
return this.engine.getNameType();
@@ -122,7 +122,7 @@ public class BeiderMorseEncoder implements StringEncoder {
/**
* Gets the rule type currently in operation.
*
- * @return the RuleType currently being used.
+ * @return The RuleType currently being used.
*/
public RuleType getRuleType() {
return this.engine.getRuleType();
diff --git a/src/main/java/org/apache/commons/codec/language/bm/Lang.java
b/src/main/java/org/apache/commons/codec/language/bm/Lang.java
index a37c5154..b02a72f5 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/Lang.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/Lang.java
@@ -197,7 +197,7 @@ public class Lang {
*
* @param text
* the word.
- * @return the language that the word originates from or {@link
Languages#ANY} if there was no unique match.
+ * @return The language that the word originates from or {@link
Languages#ANY} if there was no unique match.
*/
public String guessLanguage(final String text) {
final Languages.LanguageSet ls = guessLanguages(text);
diff --git a/src/main/java/org/apache/commons/codec/language/bm/Languages.java
b/src/main/java/org/apache/commons/codec/language/bm/Languages.java
index 632d2033..822b26d4 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/Languages.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/Languages.java
@@ -150,7 +150,7 @@ public class Languages {
/**
* Gets the language strings
*
- * @return the languages strings.
+ * @return The languages strings.
*/
public Set<String> getLanguages() {
return this.languages;
@@ -345,7 +345,7 @@ public class Languages {
/**
* Gets the language set.
*
- * @return the language set.
+ * @return The language set.
*/
public Set<String> getLanguages() {
return this.languages;
diff --git a/src/main/java/org/apache/commons/codec/language/bm/NameType.java
b/src/main/java/org/apache/commons/codec/language/bm/NameType.java
index 6fb0d1b8..21426351 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/NameType.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/NameType.java
@@ -49,7 +49,7 @@ public enum NameType {
/**
* Gets the short version of the name type.
*
- * @return the NameType short string.
+ * @return The NameType short string.
*/
public String getName() {
return this.name;
diff --git
a/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
b/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
index b62568c9..628033ef 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/PhoneticEngine.java
@@ -309,7 +309,7 @@ public class PhoneticEngine {
*
* @param phonemeBuilder the current phonemes.
* @param finalRules the final rules to apply.
- * @return the resulting phonemes.
+ * @return The resulting phonemes.
*/
private PhonemeBuilder applyFinalRules(final PhonemeBuilder phonemeBuilder,
final Map<String, List<Rule>> finalRules) {
@@ -359,7 +359,7 @@ public class PhoneticEngine {
*
* @param input
* the String to encode.
- * @return the encoding of the input.
+ * @return The encoding of the input.
*/
public String encode(final String input) {
final Languages.LanguageSet languageSet =
this.lang.guessLanguages(input);
@@ -462,7 +462,7 @@ public class PhoneticEngine {
/**
* Gets the Lang language guessing rules being used.
*
- * @return the Lang in use.
+ * @return The Lang in use.
*/
public Lang getLang() {
return this.lang;
@@ -471,7 +471,7 @@ public class PhoneticEngine {
/**
* Gets the maximum number of phonemes the engine will calculate for a
given input.
*
- * @return the maximum number of phonemes.
+ * @return The maximum number of phonemes.
* @since 1.7
*/
public int getMaxPhonemes() {
@@ -481,7 +481,7 @@ public class PhoneticEngine {
/**
* Gets the NameType being used.
*
- * @return the NameType in use.
+ * @return The NameType in use.
*/
public NameType getNameType() {
return this.nameType;
@@ -490,7 +490,7 @@ public class PhoneticEngine {
/**
* Gets the RuleType being used.
*
- * @return the RuleType in use.
+ * @return The RuleType in use.
*/
public RuleType getRuleType() {
return this.ruleType;
diff --git a/src/main/java/org/apache/commons/codec/language/bm/Rule.java
b/src/main/java/org/apache/commons/codec/language/bm/Rule.java
index 17572311..eede01dc 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/Rule.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/Rule.java
@@ -156,7 +156,7 @@ public class Rule {
/**
* Gets the language set.
*
- * @return the language set.
+ * @return The language set.
*/
public Languages.LanguageSet getLanguages() {
return this.languages;
@@ -170,7 +170,7 @@ public class Rule {
/**
* Gets the phoneme text sequence.
*
- * @return the phoneme text sequence.
+ * @return The phoneme text sequence.
*/
public CharSequence getPhonemeText() {
return this.phonemeText;
@@ -224,7 +224,7 @@ public class Rule {
/**
* Gets the expression size in phonemes.
*
- * @return the expression size in phonemes.
+ * @return The expression size in phonemes.
* @since 1.17.0
*/
default int size() {
@@ -644,7 +644,7 @@ public class Rule {
/**
* Gets the left context. This is a regular expression that must match to
the left of the pattern.
*
- * @return the left context Pattern.
+ * @return The left context Pattern.
*/
public RPattern getLContext() {
return lContext;
@@ -653,7 +653,7 @@ public class Rule {
/**
* Gets the pattern. This is a string-literal that must exactly match.
*
- * @return the pattern.
+ * @return The pattern.
*/
public String getPattern() {
return pattern;
@@ -662,7 +662,7 @@ public class Rule {
/**
* Gets the phoneme. If the rule matches, this is the phoneme associated
with the pattern match.
*
- * @return the phoneme.
+ * @return The phoneme.
*/
public PhonemeExpr getPhoneme() {
return phoneme;
@@ -671,7 +671,7 @@ public class Rule {
/**
* Gets the right context. This is a regular expression that must match to
the right of the pattern.
*
- * @return the right context Pattern.
+ * @return The right context Pattern.
*/
public RPattern getRContext() {
return rContext;
diff --git a/src/main/java/org/apache/commons/codec/language/bm/RuleType.java
b/src/main/java/org/apache/commons/codec/language/bm/RuleType.java
index 710023ac..0ad967ee 100644
--- a/src/main/java/org/apache/commons/codec/language/bm/RuleType.java
+++ b/src/main/java/org/apache/commons/codec/language/bm/RuleType.java
@@ -48,7 +48,7 @@ public enum RuleType {
/**
* Gets the rule name.
*
- * @return the rule name.
+ * @return The rule name.
*/
public String getName() {
return this.name;
diff --git a/src/main/java/org/apache/commons/codec/net/PercentCodec.java
b/src/main/java/org/apache/commons/codec/net/PercentCodec.java
index c7244397..5853a661 100644
--- a/src/main/java/org/apache/commons/codec/net/PercentCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/PercentCodec.java
@@ -136,8 +136,8 @@ public class PercentCodec implements BinaryEncoder,
BinaryDecoder {
* Decodes a byte[] Object, whose bytes are encoded with Percent-Encoding.
*
* @param obj the object to decode.
- * @return the decoding result byte[] as Object.
- * @throws DecoderException if the object is not a byte array.
+ * @return The decoding result byte[] as Object.
+ * @throws DecoderException Thrown if the object is not a byte array.
*/
@Override
public Object decode(final Object obj) throws DecoderException {
@@ -193,8 +193,8 @@ public class PercentCodec implements BinaryEncoder,
BinaryDecoder {
* Encodes an object into using the Percent-Encoding. Only byte[] objects
are accepted.
*
* @param obj the object to encode.
- * @return the encoding result byte[] as Object.
- * @throws EncoderException if the object is not a byte array.
+ * @return The encoding result byte[] as Object.
+ * @throws EncoderException Thrown if the object is not a byte array.
*/
@Override
public Object encode(final Object obj) throws EncoderException {
diff --git
a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
b/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
index 60ca8f6c..7f8e4705 100644
--- a/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/QuotedPrintableCodec.java
@@ -141,7 +141,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
* @param b byte to write.
* @param encode indicates whether the octet shall be encoded.
* @param buffer the buffer to write to.
- * @return the number of bytes that have been written to the buffer.
+ * @return The number of bytes that have been written to the buffer.
*/
private static int encodeByte(final int b, final boolean encode, final
ByteArrayOutputStream buffer) {
if (encode) {
@@ -266,7 +266,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
*
* @param index position in the array.
* @param bytes the byte array.
- * @return the unsigned octet at position {@code index} from the array.
+ * @return The unsigned octet at position {@code index} from the array.
*/
private static int getUnsignedOctet(final int index, final byte[] bytes) {
int b = bytes[index];
@@ -529,7 +529,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
/**
* Gets the default Charset name used for string decoding and encoding.
*
- * @return the default Charset name.
+ * @return The default Charset name.
* @since 1.7
*/
public Charset getCharset() {
@@ -539,7 +539,7 @@ public class QuotedPrintableCodec implements BinaryEncoder,
BinaryDecoder, Strin
/**
* Gets the default Charset name used for string decoding and encoding.
*
- * @return the default Charset name.
+ * @return The default Charset name.
*/
public String getDefaultCharset() {
return this.charset.name();
diff --git a/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
b/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
index f3b25b25..547db90b 100644
--- a/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
+++ b/src/main/java/org/apache/commons/codec/net/RFC1522Codec.java
@@ -68,8 +68,8 @@ abstract class RFC1522Codec {
*
* @param text a string to decode.
* @return A new decoded String or {@code null} if the input is {@code
null}.
- * @throws DecoderException thrown if there is an error
condition during the decoding process.
- * @throws UnsupportedEncodingException thrown if charset specified in the
"encoded-word" header is not supported.
+ * @throws DecoderException Thrown if there is an error
condition during the decoding process.
+ * @throws UnsupportedEncodingException Thrown if charset specified in the
"encoded-word" header is not supported.
*/
protected String decodeText(final String text) throws DecoderException,
UnsupportedEncodingException {
if (text == null) {
@@ -109,7 +109,7 @@ abstract class RFC1522Codec {
*
* @param bytes Data to be decoded.
* @return a byte array that contains decoded data.
- * @throws DecoderException A decoder exception is thrown if a Decoder
encounters a failure condition during the decode process.
+ * @throws DecoderException Thrown if a Decoder encounters a failure
condition during the decode process.
*/
protected abstract byte[] doDecoding(byte[] bytes) throws DecoderException;
@@ -118,7 +118,7 @@ abstract class RFC1522Codec {
*
* @param bytes Data to be encoded.
* @return A byte array containing the encoded data.
- * @throws EncoderException thrown if the Encoder encounters a failure
condition during the encoding process.
+ * @throws EncoderException Thrown if the Encoder encounters a failure
condition during the encoding process.
*/
protected abstract byte[] doEncoding(byte[] bytes) throws EncoderException;
@@ -132,7 +132,7 @@ abstract class RFC1522Codec {
* @param text a string to encode.
* @param charset a charset to be used.
* @return RFC 1522 compliant "encoded-word".
- * @throws EncoderException thrown if there is an error condition during
the Encoding process.
+ * @throws EncoderException Thrown if there is an error condition during
the Encoding process.
* @see Charset
*/
protected String encodeText(final String text, final Charset charset)
throws EncoderException {
@@ -160,8 +160,8 @@ abstract class RFC1522Codec {
* @param text a string to encode.
* @param charsetName the charset to use.
* @return RFC 1522 compliant "encoded-word".
- * @throws EncoderException thrown if there is an error
condition during the Encoding process.
- * @throws UnsupportedCharsetException if charset is not available.
+ * @throws EncoderException Thrown if there is an error
condition during the Encoding process.
+ * @throws UnsupportedCharsetException Thrown if charset is not available.
* @see Charset
*/
protected String encodeText(final String text, final String charsetName)
throws EncoderException {
@@ -175,7 +175,7 @@ abstract class RFC1522Codec {
/**
* Gets the default Charset name used for string decoding and encoding.
*
- * @return the default Charset name.
+ * @return The default Charset name.
* @since 1.7
*/
public Charset getCharset() {
@@ -185,7 +185,7 @@ abstract class RFC1522Codec {
/**
* Gets the default Charset name used for string decoding and encoding.
*
- * @return the default Charset name.
+ * @return The default Charset name.
*/
public String getDefaultCharset() {
return charset.name();
diff --git a/src/main/java/org/apache/commons/codec/net/URLCodec.java
b/src/main/java/org/apache/commons/codec/net/URLCodec.java
index 462c8a69..faa05ae4 100644
--- a/src/main/java/org/apache/commons/codec/net/URLCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/URLCodec.java
@@ -19,6 +19,8 @@ package org.apache.commons.codec.net;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
import java.util.BitSet;
import org.apache.commons.codec.BinaryDecoder;
@@ -33,8 +35,8 @@ import org.apache.commons.codec.binary.StringUtils;
/**
* Implements the 'www-form-urlencoded' encoding scheme, also misleadingly
known as URL encoding.
* <p>
- * This codec is meant to be a replacement for standard Java classes {@link
java.net.URLEncoder} and
- * {@link java.net.URLDecoder} on older Java platforms, as these classes in
Java versions below
+ * This codec is meant to be a replacement for standard Java classes {@link
URLEncoder} and
+ * {@link URLDecoder} on older Java platforms, as these classes in Java
versions below
* 1.4 rely on the platform's default charset encoding.
* </p>
* <p>
@@ -354,7 +356,7 @@ public class URLCodec implements BinaryEncoder,
BinaryDecoder, StringEncoder, St
/**
* The default charset used for string decoding and encoding.
*
- * @return the default string charset.
+ * @return The default string charset.
*/
public String getDefaultCharset() {
return this.charset;
@@ -363,7 +365,7 @@ public class URLCodec implements BinaryEncoder,
BinaryDecoder, StringEncoder, St
/**
* The {@code String} encoding used for decoding and encoding.
*
- * @return the encoding.
+ * @return The encoding.
* @deprecated Use {@link #getDefaultCharset()}, will be removed in 2.0.
*/
@Deprecated
diff --git a/src/main/java/org/apache/commons/codec/net/Utils.java
b/src/main/java/org/apache/commons/codec/net/Utils.java
index a53ec7a7..ab13426e 100644
--- a/src/main/java/org/apache/commons/codec/net/Utils.java
+++ b/src/main/java/org/apache/commons/codec/net/Utils.java
@@ -56,7 +56,7 @@ final class Utils {
* Returns the upper case hexadecimal digit of the lower 4 bits of the int.
*
* @param b the input int.
- * @return the upper case hexadecimal digit of the lower 4 bits of the int.
+ * @return The upper case hexadecimal digit of the lower 4 bits of the int.
*/
static char hexChar(final int b) {
return Character.toUpperCase(Character.forDigit(b & 0xF, RADIX));
diff --git a/src/test/java/org/apache/commons/codec/binary/Base16Test.java
b/src/test/java/org/apache/commons/codec/binary/Base16Test.java
index cb218e8e..8aaeb6b4 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base16Test.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base16Test.java
@@ -44,7 +44,7 @@ class Base16Test {
private final Random random = new Random();
/**
- * @return the random.
+ * @return The random.
*/
Random getRandom() {
return this.random;
diff --git a/src/test/java/org/apache/commons/codec/binary/Base64Test.java
b/src/test/java/org/apache/commons/codec/binary/Base64Test.java
index 229587fe..1c0b4294 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base64Test.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base64Test.java
@@ -171,7 +171,7 @@ class Base64Test {
private final Random random = new Random();
/**
- * @return the random.
+ * @return The random.
*/
Random getRandom() {
return this.random;
diff --git a/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
b/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
index 885630da..b1b65403 100644
--- a/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
@@ -102,7 +102,7 @@ class BaseNCodecTest {
* long presumableFreeMemory = Runtime.getRuntime().maxMemory() -
allocatedMemory;
* </pre>
*
- * @return the presumable free memory
+ * @return The presumable free memory
* @see <a href="https://stackoverflow.com/a/18366283">
* Christian Fries StackOverflow answer on Java available memory</a>
*/
diff --git a/src/test/java/org/apache/commons/codec/binary/HexTest.java
b/src/test/java/org/apache/commons/codec/binary/HexTest.java
index 1fe2b7cd..51a27ab0 100644
--- a/src/test/java/org/apache/commons/codec/binary/HexTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/HexTest.java
@@ -54,7 +54,7 @@ class HexTest {
* {@link ByteBuffer#allocateDirect(int)}
*
* @param capacity the capacity
- * @return the byte buffer
+ * @return The byte buffer
*/
protected ByteBuffer allocate(final int capacity) {
return ByteBuffer.allocate(capacity);
@@ -121,7 +121,7 @@ class HexTest {
* <p>The buffer is allocated using {@link #allocate(int)}.
*
* @param string the String to encode
- * @return the byte buffer
+ * @return The byte buffer
*/
private ByteBuffer getByteBufferUtf8(final String string) {
final byte[] bytes = string.getBytes(StandardCharsets.UTF_8);
diff --git a/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
b/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
index 24015f19..bf20238d 100644
--- a/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
+++ b/src/test/java/org/apache/commons/codec/digest/MurmurHash3Test.java
@@ -154,7 +154,7 @@ class MurmurHash3Test {
/**
* Creates a set of long values to test the hash utility methods.
*
- * @return the data
+ * @return The data
*/
private static long[] createLongTestData() {
final long[] data = new long[100];
@@ -173,7 +173,7 @@ class MurmurHash3Test {
* Creates the random blocks of data to process up to max length.
*
* @param maxLength the max length
- * @return the blocks
+ * @return The blocks
*/
private static int[] createRandomBlocks(final int maxLength) {
final int[] blocks = new int[20];