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

Method hash

basex-core/src/main/java/org/basex/util/Strings.java:212–219  ·  view source on GitHub ↗

Returns a hash in lower case. @param string string to be hashed @param algo hashing algorithm @return hash

(final String string, final String algo)

Source from the content-addressed store, hash-verified

210 * @return hash
211 */
212 private static String hash(final String string, final String algo) {
213 try {
214 final MessageDigest md = MessageDigest.getInstance(algo);
215 return Token.string(Token.hex(md.digest(Token.token(string)), false));
216 } catch(final Exception ex) {
217 throw Util.notExpected(ex);
218 }
219 }
220
221 /**
222 * Returns a unified representation of the specified encoding.

Callers 2

md5Method · 0.95
sha256Method · 0.95

Calls 6

stringMethod · 0.95
hexMethod · 0.95
tokenMethod · 0.95
notExpectedMethod · 0.95
getInstanceMethod · 0.45
digestMethod · 0.45

Tested by

no test coverage detected