3434 * into the Public Domain.
3535 * <p>
3636 * This class is immutable and thread-safe.
37- *
37+ *
3838 * @version $Id$
3939 * @since 1.7
4040 */
@@ -72,7 +72,10 @@ public class Sha2Crypt {
7272 * Generates a libc crypt() compatible "$5$" hash value with random salt.
7373 * <p>
7474 * See {@link Crypt#crypt(String, String)} for details.
75- *
75+ *
76+ * @param keyBytes
77+ * plaintext to hash
78+ * @return complete hash value
7679 * @throws RuntimeException
7780 * when a {@link java.security.NoSuchAlgorithmException} is caught.
7881 */
@@ -84,7 +87,12 @@ public static String sha256Crypt(final byte[] keyBytes) {
8487 * Generates a libc6 crypt() compatible "$5$" hash value.
8588 * <p>
8689 * See {@link Crypt#crypt(String, String)} for details.
87- *
90+ *
91+ * @param keyBytes
92+ * plaintext to hash
93+ * @param salt
94+ * real salt value without prefix or "rounds="
95+ * @return complete hash value including salt
8896 * @throws IllegalArgumentException
8997 * if the salt does not match the allowed pattern
9098 * @throws RuntimeException
@@ -100,13 +108,13 @@ public static String sha256Crypt(final byte[] keyBytes, String salt) {
100108 /**
101109 * Generates a libc6 crypt() compatible "$5$" or "$6$" SHA2 based hash value.
102110 * <p>
103- * This is a nearly line by line conversion of the original C function. The numbered comments are from the
104- * algorithm description, the short C-style ones from the original C code and the ones with "Remark" from me.
111+ * This is a nearly line by line conversion of the original C function. The numbered comments are from the algorithm
112+ * description, the short C-style ones from the original C code and the ones with "Remark" from me.
105113 * <p>
106114 * See {@link Crypt#crypt(String, String)} for details.
107- *
115+ *
108116 * @param keyBytes
109- * plaintext that should be hashed
117+ * plaintext to hash
110118 * @param salt
111119 * real salt value without prefix or "rounds="
112120 * @param saltPrefix
@@ -123,7 +131,7 @@ public static String sha256Crypt(final byte[] keyBytes, String salt) {
123131 * @see MessageDigestAlgorithms
124132 */
125133 private static String sha2Crypt (final byte [] keyBytes , final String salt , final String saltPrefix ,
126- final int blocksize , final String algorithm ) {
134+ final int blocksize , final String algorithm ) {
127135
128136 final int keyLen = keyBytes .length ;
129137
@@ -502,7 +510,10 @@ private static String sha2Crypt(final byte[] keyBytes, final String salt, final
502510 * Generates a libc crypt() compatible "$6$" hash value with random salt.
503511 * <p>
504512 * See {@link Crypt#crypt(String, String)} for details.
505- *
513+ *
514+ * @param keyBytes
515+ * plaintext to hash
516+ * @return complete hash value
506517 * @throws RuntimeException
507518 * when a {@link java.security.NoSuchAlgorithmException} is caught.
508519 */
@@ -514,7 +525,12 @@ public static String sha512Crypt(final byte[] keyBytes) {
514525 * Generates a libc6 crypt() compatible "$6$" hash value.
515526 * <p>
516527 * See {@link Crypt#crypt(String, String)} for details.
517- *
528+ *
529+ * @param keyBytes
530+ * plaintext to hash
531+ * @param salt
532+ * real salt value without prefix or "rounds="
533+ * @return complete hash value including salt
518534 * @throws IllegalArgumentException
519535 * if the salt does not match the allowed pattern
520536 * @throws RuntimeException
0 commit comments