[pwd] javadoc
authorAsier Lostalé <asier.lostale@openbravo.com>
Wed, 02 Oct 2019 13:08:14 +0200
changeset 36615 ac52852c65a1
parent 36614 cfb68c364b5f
child 36616 dee41e082133
[pwd] javadoc
src/org/openbravo/authentication/hashing/HashingAlgorithm.java
--- a/src/org/openbravo/authentication/hashing/HashingAlgorithm.java	Tue Oct 01 15:30:04 2019 +0200
+++ b/src/org/openbravo/authentication/hashing/HashingAlgorithm.java	Wed Oct 02 13:08:14 2019 +0200
@@ -26,7 +26,18 @@
 /** Algorithm used to hash password to store in Database */
 public abstract class HashingAlgorithm {
 
-  /** Generates a hash using current algorithm */
+  /**
+   * Generates a hash using current algorithm, hashes should look like: {@code version$salt$hashed}
+   * where:
+   * <p>
+   * <ul>
+   * <li>{@code version}: is a numeric value that determines the version of the
+   * {@code HashingAlgorithm} that performed the hash. It must match the value returned by
+   * {@link #getAlgorithmVersion()}.
+   * <li>{@code salt}: salt used in the hash.
+   * <li>{@code hashed}: actual hash, which is computed by {@link #hash(String, String)}.
+   * </ul>
+   */
   protected abstract String generateHash(String password);
 
   /**
@@ -43,6 +54,10 @@
   /** Returns the low level algorithm used to perform the hashing. */
   protected abstract MessageDigest getHashingBaseAlgorithm();
 
+  /**
+   * Performs the low level hashing of {@code plainText} salted with {@code salt} value. Salt can be
+   * null in which case will be ignored.
+   */
   protected final String hash(String plainText, String salt) {
     MessageDigest md = getHashingBaseAlgorithm();
     if (salt != null) {