cr-marcstevens / hashclash

Project HashClash - MD5 & SHA-1 cryptanalysis
Other
742 stars 87 forks source link

call to 'hw' is ambiguous #8

Closed Maijin closed 4 years ago

Maijin commented 4 years ago

While assisting @angea workshop and compiling on mac I had to comment those 2 calls:

src/sha1helper/filter.cpp:203:7: error: call to 'hw' is ambiguous
                if (hw(++cnt) == 1)
                    ^~
./lib/hashclash/sdr.hpp:41:18: note: candidate function
        inline unsigned hw(int n) { return hw(uint32(n)); }
                        ^
./lib/hashclash/sdr.hpp:42:18: note: candidate function
        inline unsigned hw(uint64 n) {
                        ^
./lib/hashclash/sdr.hpp:207:18: note: candidate function
        inline unsigned hw(uint32 n)
                        ^
./lib/hashclash/sdr.hpp:228:18: note: candidate function
        inline unsigned hw(const sdr& n)
                        ^
src/sha1helper/filter.cpp:208:8: error: call to 'hw' is ambiguous
                        if (hw(++cnt2) == 1)
                            ^~
./lib/hashclash/sdr.hpp:41:18: note: candidate function
        inline unsigned hw(int n) { return hw(uint32(n)); }
                        ^
./lib/hashclash/sdr.hpp:42:18: note: candidate function
        inline unsigned hw(uint64 n) {
                        ^
./lib/hashclash/sdr.hpp:207:18: note: candidate function
        inline unsigned hw(uint32 n)
                        ^
./lib/hashclash/sdr.hpp:228:18: note: candidate function
        inline unsigned hw(const sdr& n)
                        ^
cr-marcstevens commented 4 years ago

I see what I did wrong, I counted on std::size_t to be equivalent to uint64/uint64_t. But apparently it does not map to int, uint32_t or uint64_t. Can you try if changing line 200 as follows:

uint64 cnt = 0, cnt2 = 0;

(and not commenting out lines 203 and 208) fixes the issue?

Maijin commented 4 years ago

Yep tested and created a PR https://github.com/cr-marcstevens/hashclash/pull/10