MCPcopy Create free account
hub / github.com/BaseXdb/basex / password

Method password

basex-core/src/main/java/org/basex/core/users/User.java:182–194  ·  view source on GitHub ↗

Computes new password hashes. @param password password (plain text)

(final String password)

Source from the content-addressed store, hash-verified

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.

Callers 3

UserMethod · 0.95
runMethod · 0.95
runMethod · 0.95

Calls 6

digestMethod · 0.95
sha256Method · 0.80
toStringMethod · 0.65
valuesMethod · 0.45
computeIfAbsentMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected