@Override protected String getDigest(String value) { return DigestUtils.sha512Hex(value); }
@Override public void eval() { String input = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput.start, rawInput.end, rawInput.buffer); String sha512 = org.apache.commons.codec.digest.DigestUtils.sha512Hex(input); out.buffer = buffer; out.start = 0; out.end = sha512.getBytes().length; buffer.setBytes(0, sha512.getBytes()); }
@Test public void testSha512() throws IOException { // Examples from FIPS 180-2 assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" + "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", DigestUtils.sha512Hex("abc")); assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" + "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f", DigestUtils.sha512Hex(getBytesUtf8("abc"))); assertEquals("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018" + "501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909", DigestUtils.sha512Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn" + "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu")); }
private static String hash(FileSystem fs, Path dir, String name) throws IOException { try (FSDataInputStream in = fs.open(new Path(dir, name))) { return DigestUtils.sha512Hex(in); } }
@UserFunction @Description("apoc.util.sha512([values]) | computes the sha512 of the concatenation of all string values of the list") public String sha512(@Name("values") List<Object> values) { String value = values.stream().map(v -> v == null ? "" : v.toString()).collect(Collectors.joining()); return DigestUtils.sha512Hex(value); }
/** * Calculates the SHA-512 digest and returns the value as a hex string. * * @param input the input * @return the value as hex * @since 4.2 */ public static String sha512Hex(final String input) { return DigestUtils.sha512Hex(input); } }
protected String hashPassword(final String password) { if (password == null) { return ""; } return DigestUtils.sha512Hex(password); }
@Override public String anonimize(String value) { return DigestUtils.sha512Hex(value); } },
public static String hashPassword(String password, String salt) { String unencryptedBytes = salt + password + salt; return DigestUtils.sha512Hex(unencryptedBytes); }
private String encryptPwd(String pwd) { return DigestUtils.sha512Hex(pwd); }}
public static String encryptPwd(String pwd) { return DigestUtils.sha512Hex(pwd); }
public static String hash(String str) { return DigestUtils.sha512Hex(str); }
public static String sha512ViaCommonsCodec(String value) { LOGGER.debug("Hashing {} with sha-512 hashing algorithm via commons codec", value); return DigestUtils.sha512Hex(value); }
protected void patchUrlParameters(@NotNull final List<NameValuePair> urlParameters) { final String computerName = getComputerName(); if (computerName != null) { urlParameters.add(new BasicNameValuePair("computer_name", DigestUtils.sha512Hex(computerName))); } }
final String generateFingerPrint() { final StringBuilder sb = getFingerPrintableString(); return DigestUtils.sha512Hex(sb.toString()); }
final String generateFingerPrint() { final StringBuilder sb = getFingerPrintableString(); return DigestUtils.sha512Hex(sb.toString()); }
public String generateUniqueApiSecret() { return DigestUtils.sha512Hex(getUniqueString()); }
public String generateUniqueApiSecret() { return DigestUtils.sha512Hex(getUniqueString()); }
@Override public boolean evaluate(final PasswordPair passwordPair) { return passwordPair.getFilePassword().equals(DigestUtils.sha512Hex(passwordPair.getSuppliedPassword())); } });