@Test public void testGetMessageDigestHash() { assertEquals(6808551913422584641L, NumericUtils.getMessageDigestHash("MD5", "This is a string")); assertEquals(2549749777095932358L, NumericUtils.getMessageDigestHash("MD5", "This is a test string")); assertNotEquals(1L, NumericUtils.getMessageDigestHash("MD5", "This")); assertNotEquals(6808551913422584641L, NumericUtils.getMessageDigestHash("SHA-256", "This is a string")); }
public static long getMessageDigestHash(final String algorithmName, final String string) { MessageDigest md; try { md = MessageDigest.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new HoodieException(e); } return asLong(Objects.requireNonNull(md).digest(string.getBytes(StandardCharsets.UTF_8))); }
NumericUtils { public static long getMessageDigestHash(final String algorithmName, final String string) { MessageDigest md; try { md = MessageDigest.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new HoodieException(e); } return asLong(Objects.requireNonNull(md).digest(string.getBytes(StandardCharsets.UTF_8))); } }
NumericUtils { public static long getMessageDigestHash(final String algorithmName, final String string) { MessageDigest md; try { md = MessageDigest.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new HoodieException(e); } return asLong(Objects.requireNonNull(md).digest(string.getBytes(StandardCharsets.UTF_8))); }  }
NumericUtils { public static long getMessageDigestHash(final String algorithmName, final String string) { MessageDigest md; try { md = MessageDigest.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new HoodieException(e); } return asLong(Objects.requireNonNull(md).digest(string.getBytes(StandardCharsets.UTF_8))); }  static String humanReadableByteCount(double bytes); static long getMessageDigestHash(final String algorithmName, final String string); static long asLong(byte[] bytes); static long padToLong(byte[] bytes); }
NumericUtils { public static long getMessageDigestHash(final String algorithmName, final String string) { MessageDigest md; try { md = MessageDigest.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new HoodieException(e); } return asLong(Objects.requireNonNull(md).digest(string.getBytes(StandardCharsets.UTF_8))); }  static String humanReadableByteCount(double bytes); static long getMessageDigestHash(final String algorithmName, final String string); static long asLong(byte[] bytes); static long padToLong(byte[] bytes);  }