Computes new password hashes. @param password password (plain text)
(final String password)
| 180 | * @param password password (plain text) |
| 181 | */ |
| 182 | public synchronized void password(final String password) { |
| 183 | for(final Algorithm algorithm : Algorithm.values()) { |
| 184 | final EnumMap<Code, String> codes = passwords.computeIfAbsent(algorithm, |
| 185 | k -> new EnumMap<>(Code.class)); |
| 186 | if(algorithm == Algorithm.SALTED_SHA256) { |
| 187 | final String salt = Long.toString(System.nanoTime()); |
| 188 | codes.put(Code.SALT, salt); |
| 189 | codes.put(Code.HASH, sha256(salt + password)); |
| 190 | } else { |
| 191 | codes.put(Code.HASH, digest(name, password)); |
| 192 | } |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Returns the specified code. |