8000 Javadoc and minor formating. · apache/commons-codec@03fd138 · GitHub
Skip to content

Commit 03fd138

Browse files
committed
Javadoc and minor formating.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1379812 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3326156 commit 03fd138

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

src/main/java/org/apache/commons/codec/digest/Sha2Crypt.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
* Based on the C implementation released into the Public Domain by Ulrich Drepper <drepper@redhat.com>
3030
* http://www.akkadia.org/drepper/SHA-crypt.txt
3131
* <p>
32-
* Conversion to Kotlin and from there to Java in 2012 by Christian Hammers &lt;ch@lathspell.de&gt;
33-
* and likewise put into the Public Domain.
32+
* Conversion to Kotlin and from there to Java in 2012 by Christian Hammers &lt;ch@lathspell.de&gt; and likewise put
33+
* into the Public Domain.
3434
* <p>
3535
* This class is immutable and thread-safe.
3636
*
@@ -64,16 +64,16 @@ public class Sha2Crypt {
6464
static final String SHA512_PREFIX = "$6$";
6565

6666
/** The pattern to match valid salt values. */
67-
private static final Pattern SALT_PATTERN =
68-
Pattern.compile("^\\$([56])\\$(rounds=(\\d+)\\$)?([\\.\\/a-zA-Z0-9]{1,16}).*");
67+
private static final Pattern SALT_PATTERN = Pattern
68+
.compile("^\\$([56])\\$(rounds=(\\d+)\\$)?([\\.\\/a-zA-Z0-9]{1,16}).*");
6969

7070
/**
7171
* Generates a libc crypt() compatible "$5$" hash value with random salt.
7272
* <p>
7373
* See {@link Crypt#crypt(String, String)} for details.
7474
*
7575
* @throws RuntimeException
76-
* when a {@link java.security.NoSuchAlgorithmException} is caught.
76+
* when a {@link java.security.NoSuchAlgorithmException} is caught.
7777
*/
7878
public static String sha256Crypt(byte[] keyBytes) {
7979
return sha256Crypt(keyBytes, null);
@@ -84,9 +84,10 @@ public static String sha256Crypt(byte[] keyBytes) {
8484
* <p>
8585
* See {@link Crypt#crypt(String, String)} for details.
8686
*
87-
* @throws IllegalArgumentException if the salt does not match the allowed pattern
87+
* @throws IllegalArgumentException
88+
* if the salt does not match the allowed pattern
8889
* @throws RuntimeException
89-
* when a {@link java.security.NoSuchAlgorithmException} is caught.
90+
* when a {@link java.security.NoSuchAlgorithmException} is caught.
9091
*/
9192
public static String sha256Crypt(byte[] keyBytes, String salt) {
9293
if (salt == null) {
@@ -98,9 +99,8 @@ public static String sha256Crypt(byte[] keyBytes, String salt) {
9899
/**
99100
* Generates a libc6 crypt() compatible "$5$" or "$6$" SHA2 based hash value.
100101
* <p>
101-
* This is a nearly line by line conversion of the original C function. The numbered comments
102-
* are from the algorithm description, the short C-style ones from the original C code and the
103-
* ones with "Remark" from me.
102+
* This is a nearly line by line conversion of the original C function. The numbered comments are from the
103+
* algorithm description, the short C-style ones from the original C code and the ones with "Remark" from me.
104104
* <p>
105105
* See {@link Crypt#crypt(String, String)} for details.
106106
*
@@ -115,12 +115,12 @@ public static String sha256Crypt(byte[] keyBytes, String salt) {
115115
* @param algorithm
116116
* {@link MessageDigest} algorithm identifier string
117117
* @return complete hash value including prefix and salt
118-
* @throws IllegalArgumentException if the given salt is {@code null} or does not match the allowed pattern
118+
* @throws IllegalArgumentException
119+
* if the given salt is {@code null} or does not match the allowed pattern
119120
* @throws RuntimeException
120-
* when a {@link java.security.NoSuchAlgorithmException} is caught.
121+
* when a {@link java.security.NoSuchAlgorithmException} is caught.
121122
*/
122-
private static String sha2Crypt(byte[] keyBytes, String salt, String saltPrefix, int blocksize, String algorithm)
123-
{
123+
private static String sha2Crypt(byte[] keyBytes, String salt, String saltPrefix, int blocksize, String algorithm) {
124124

125125
int keyLen = keyBytes.length;
126126

@@ -501,7 +501,7 @@ private static String sha2Crypt(byte[] keyBytes, String salt, String saltPrefix,
501501
* See {@link Crypt#crypt(String, String)} for details.
502502
*
503503
* @throws RuntimeException
504-
* when a {@link java.security.NoSuchAlgorithmException} is caught.
504+
* when a {@link java.security.NoSuchAlgorithmException} is caught.
505505
*/
506506
public static String sha512Crypt(byte[] keyBytes) {
507507
return sha512Crypt(keyBytes, null);
@@ -512,9 +512,10 @@ public static String sha512Crypt(byte[] keyBytes) {
512512
* <p>
513513
* See {@link Crypt#crypt(String, String)} for details.
514514
*
515-
* @throws IllegalArgumentException if the salt does not match the allowed pattern
515+
* @throws IllegalArgumentException
516+
* if the salt does not match the allowed pattern
516517
* @throws RuntimeException
517-
* when a {@link java.security.NoSuchAlgorithmException} is caught.
518+
* when a {@link java.security.NoSuchAlgorithmException} is caught.
518519
*/
519520
public static String sha512Crypt(byte[] keyBytes, String salt) {
520521
if (salt == null) {

0 commit comments

Comments
 (0)