![]() |
|
Date: Tue, 5 May 2015 22:53:10 +0300 From: Aleksey Cherepanov <lyosha@...nwall.com> To: john-dev@...ts.openwall.com Subject: Re: get_binary_*() and get_hash_*() methods On Tue, May 05, 2015 at 09:07:49PM +0200, Frank Dittrich wrote: > On 05/05/2015 08:53 PM, Aleksey Cherepanov wrote: > > Formats provide get_binary_[0-6]() and get_hash_[0-6]() methods to > > john. If the algo in them is the same then it is possible to construct > > default cmp_all function. Are they used this way? Are they required to > > have the same algo? If so, why is not there default cmp_all() based on > > them? > > I think many formats could just use fmt_default_binary_hash_0 - > fmt_default_binary_hash_6. Only formats which know that their hashes > have a non-random distribution in (certain parts of) their hashes should > need to implement their own binary_hash_[0-6]. > But I think fmt_default_binary_hash_0 - fmt_default_binary_hash_6 are > jumbo specific, they don't exist in core. > > But fmt_default_salt_hash just returns 0 (which is OK for saltless hashes). > So, we would need other "default" implementations for salt_hash_[0-6]. I don't touch salt_hash() yet. 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; } Though some formats define get_hash_6 as "return 0;". 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? Thanks! -- Regards, Aleksey Cherepanov
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.