Hash { public static String ripemd160(String hexInput) { byte[] bytes = Numeric.hexStringToByteArray(hexInput); byte[] result = ripemd160(bytes); return Numeric.toHexString(result); } private  Hash(); static byte[] sha256AndThenRipemd160(byte[] input); static String ripemd160(String hexInput); static byte[] ripemd160(byte[] input); static String sha3(String hexInput); static byte[] sha3(byte[] input, int offset, int length); static byte[] sha3(byte[] input); static String sha3String(String utf8String); static byte[] sha256(byte[] input); static byte[] sha256(byte[] input, int offset, int length); static byte[] hash256(byte[] input); static byte[] hash256(byte[] input, int offset, int length);  }
@Test public void testRipeMD160() { final String expected = "c5d570cb5b85319dbafc0385b998fd98eb62295e"; final byte[] bytesToHash = "Hello World.".getBytes(); final byte[] result = Hash.ripemd160(bytesToHash); assertThat(Numeric.toHexStringNoPrefix(result), is(expected)); }
@Test public void testRipeMD160String() { final String expected = "0xc5d570cb5b85319dbafc0385b998fd98eb62295e"; final String hexStringToHash = Numeric.toHexString("Hello World.".getBytes()); final String result = Hash.ripemd160(hexStringToHash); assertThat(result, is(expected)); }