From 1b2710138f45e208c68fa607dbd0ff4c93543084 Mon Sep 17 00:00:00 2001
From: Dung Ta Van
- * String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt());
- *
+ * + * String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt()); + **
* To check whether a plaintext password matches one that has been hashed previously, use * the checkpw method: *
- *
- * if (BCrypt.checkpw(candidate_password, stored_hash))
- * System.out.println("It matches");
- * else
- * System.out.println("It does not match");
- *
+ * + * if (BCrypt.checkpw(candidate_password, stored_hash)) + * System.out.println("It matches"); + * else*
+ * System.out.println("It does not match"); + *
* The gensalt() method takes an optional parameter (log_rounds) that determines the * computational complexity of the hashing: *
- *
- * String strong_salt = BCrypt.gensalt(10)
- * String stronger_salt = BCrypt.gensalt(12)
- *
+ * + * String strong_salt = BCrypt.gensalt(10) + * String stronger_salt = BCrypt.gensalt(12) + **
* 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.