:: Re: [Libbitcoin] new ripemd generat…
Top Page
Delete this message
Reply to this message
Author: Eric Voskuil
Date:  
To: Amir Taaki
CC: Libbitcoin@lists.dyne.org
Subject: Re: [Libbitcoin] new ripemd generates different hashes
A hash function is a function in the mathematical sense, same input = same output (i.e. deterministic). So assuming this was proper from the start, the integration is the issue. Also probabilistically comparative tests should fail if it's incorrect.

e

Sent from my iPhone

> On Apr 17, 2014, at 2:17 PM, "Amir Taaki" <genjix@???> wrote:
>
> I think maybe the library just generates different hashes and is not
> compatible? Or am I wrong?
>
>> Thanks for putting the tests together Amir. I'm tied up for the next few
>> hours. The most likely issue is that my port changed something
>> inadvertently. Possibly the endian issue - I replaced the endianess test
>> with boost's.
>>
>> e
>>
>> Sent from my iPhone
>>
>>> On Apr 17, 2014, at 1:20 PM, "Amir Taaki" <genjix@???> wrote:
>>>
>>> $ cd libbitcoin/test/
>>> $ ./make.sh
>>> Linking...
>>> Running 8 test cases...
>>> hash.cpp(32): fatal error in "sha256_hash": critical check
>>> encode_hex(ripemd_hash) == "17d040b739d639c729daaf627eaff88cfe4207f4"
>>> failed
>>>
>>> *** 1 failure detected in test suite "libbitcoin tests"
>>>
>>>
>>>> between computer 1 (working) and computer 2 (newest). I've added a unit
>>>> test for ripemd in test/ which should pass.
>>>>
>>>> genjix@astra1609:~$ cat test.cpp
>>>> #include <bitcoin/bitcoin.hpp>
>>>> using namespace bc;
>>>>
>>>> int main()
>>>> {
>>>> std::cout << generate_ripemd_hash(data_chunk{{110}}) << std::endl;
>>>> return 0;
>>>> }
>>>>
>>>> genjix@astra1609:~$ ./a.out
>>>> 17d040b739d639c729daaf627eaff88cfe4207f4
>>>>
>>>> --------------------------------------------
>>>>
>>>> /tmp> cat rh.cpp
>>>> #include <bitcoin/bitcoin.hpp>
>>>> using namespace bc;
>>>>
>>>> int main()
>>>> {
>>>>       std::cout << generate_short_hash(data_chunk{{110}}) <<
>>>> std::endl;
>>>>           return 0;
>>>> }

>>>>
>>>> /tmp> ./a.out
>>>> 2a392d9c021a12ab0b51d90e438a54b11bf27497
>>>>
>>>> --------------------
>>>>
>>>> and when I add output to the libbitcoin ripemd hash function in the
>>>> source:
>>>>
>>>> sha hash:
>>>> 1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9
>>>> ripemd hash: 17d040b739d639c729daaf627eaff88cfe4207f4
>>>> 17d040b739d639c729daaf627eaff88cfe4207f4
>>>>
>>>> ---------------
>>>> (newest)
>>>>
>>>> sha256:
>>>> 1b16b1df538ba12dc3f97edbb85caa7050d46c148134290feba80f8236c83db9
>>>> ripemd: 2a392d9c021a12ab0b51d90e438a54b11bf27497
>>>> 2a392d9c021a12ab0b51d90e438a54b11bf27497
>>>
>>>
>>> _______________________________________________
>>> Libbitcoin mailing list
>>> Libbitcoin@???
>>> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin
>
>
> _______________________________________________
> Libbitcoin mailing list
> Libbitcoin@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/libbitcoin