Skip to content

Commit

Permalink
update BCrypt docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tvd12 committed Jul 21, 2022
1 parent 2176aac commit 1b27101
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ezyfox-security/src/main/java/com/tvd12/ezyfox/security/BCrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@
* Usage is really simple. To hash a password for the first time, call the hashpw method
* with a random salt, like this:
* </p>
* <code>
* String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); <br />
* </code>
* <pre>
* String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt());
* </pre>
* <p>
* To check whether a plaintext password matches one that has been hashed previously, use
* the checkpw method:
* </p>
* <code>
* if (BCrypt.checkpw(candidate_password, stored_hash))<br />
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It matches");<br />
* else<br />
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It does not match");<br />
* </code>
* <pre>
* if (BCrypt.checkpw(candidate_password, stored_hash))
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It matches");
* else<br>
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It does not match");
* </pre>
* <p>
* The gensalt() method takes an optional parameter (log_rounds) that determines the
* computational complexity of the hashing:
* </p>
* <code>
* String strong_salt = BCrypt.gensalt(10)<br />
* String stronger_salt = BCrypt.gensalt(12)<br />
* </code>
* <pre>
* String strong_salt = BCrypt.gensalt(10)
* String stronger_salt = BCrypt.gensalt(12)
* </pre>
* <p>
* The amount of work increases exponentially (2**log_rounds), so each increment is twice
* as much work. The default log_rounds is 10, and the valid range is 4 to 31.
Expand Down

0 comments on commit 1b27101

Please sign in to comment.