|
Date: Tue, 05 May 2015 22:40:24 +0200 From: magnum <john.magnum@...hmail.com> To: john-dev@...ts.openwall.com Subject: Re: get_binary_*() and get_hash_*() methods On 2015-05-05 21:53, Aleksey Cherepanov wrote: > I mean, we can implement cmp_all using other methods, something like > the following: > > static int cmp_all(void *binary, int count) > { > int i; > int b = fmt_default_binary_hash_6(binary); > for (i = 0; i < count; i++) { > if (get_hash_6(i) == b) > return 1; > } > return 0; > } That's a function call inside a hot loop and the compiler can't optimize it away (but you realized this below). > Though some formats define get_hash_6 as "return 0;". Sounds like a bug to me. I think there should be no get_hash_6 in that case (ie. the function pointer should be NULL). > Hm, get_hash_6 is in format's file. self is needed to access it in > default implementation. But then it will not be inlined. > > A macro may be used to insert the code of cmp_all into format's file. > Though get_hash_6 gives only 31 bits, while raw-sha512 checks all 64 > bits in 1 check. > > So I think my question about default implementation of cmp_all is > solved. > > Does binary_hash_6() and get_hash_6() functions have to return the > same values for the same hashes? Yes that's the whole point of these functions, and the self-tests tries to verify this. magnum
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.