Can you explain please: where is correct way to get ripemd160?
...
I try :-)
Bitcoin does not work with hashed strings, instead these are hex values. So I convert string first into the hex values into a file, to be used as input for the hash function. In a simple shell script (POSIX compliant) I do this:
#!/bin/sh
tmp_hex_fn=tmp_file.hex
tmp_hex_sha256_fn=tmp_sha256.hex
tmp_txt_sha256_fn=tmp_sha256.txt
tmp_hex_dsha256_fn=tmp_dsha256.hex
tmp_txt_dsha256_fn=tmp_dsha256.txt
tmp_hex_ripemd160_fn=tmp_ripemd160.hex
tmp_txt_ripemd160_fn=tmp_ripemd160.txt
printf $( echo $1 | sed 's/[[:xdigit:]]\{2\}/\\x&/g' ) > $tmp_hex_fn
hexdump -C $tmp_hex_fn
# sha256
openssl dgst -sha256 <$tmp_hex_fn >$tmp_txt_sha256_fn
openssl dgst -sha256 -binary <$tmp_hex_fn >$tmp_hex_sha256_fn
openssl dgst -sha256 <$tmp_hex_sha256_fn >$tmp_txt_dsha256_fn
openssl dgst -sha256 -binary <$tmp_hex_sha256_fn >$tmp_hex_dsha256_fn
printf "sha256: "
cat $tmp_txt_sha256_fn
printf "dsha256: "
cat $tmp_txt_dsha256_fn
# ripemd160
openssl dgst -binary -ripemd160 <$tmp_hex_fn >$tmp_hex_ripemd160_fn
openssl dgst -ripemd160 <$tmp_hex_fn >$tmp_txt_ripemd160_fn
printf "ripemd160: "
cat $tmp_txt_ripemd160_fn
Interestingly enough I get a different result when doing ripemd160 on the string:
echo "c47907abd2a80492ca9388b05c0e382518ff3960" | openssl dgst -ripemd160
(stdin)= 2382de811bcd78c91976075b0fbe81af987f5e93
Now I'm puzzled, what values are delivered on these web pages... needs some further review.