Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
b0dre
on 02/04/2025, 20:08:14 UTC
New version uses AVX2 for fast partial hash comparisons

https://github.com/NoMachine1/Mutagen/blob/main/mutagen.cpp

First checks 4 bytes using AVX2

Quote
               for (int j = 0; j < HASH_BATCH_SIZE; j++) {
                    // Load candidate hash
                    __m256i cand = _mm256_loadu_si256(reinterpret_cast<const __m256i*>(localHashResults[j]));
                   
                    // Compare first 4 bytes using AVX2
                    __m256i cmp = _mm256_cmpeq_epi8(cand, target16);
                    int mask = _mm256_movemask_epi8(cmp);
                   
                    if ((mask & 0x0F) == 0x0F) {  // First 4 bytes match
                        // Full comparison
                        bool fullMatch = true;
                        for (int k = 0; k < 20; k++) {
                            if (localHashResults[j][k] != TARGET_HASH160_RAW[k]) {
                                fullMatch = false;
                                break;
                            }
                        }

                        if (fullMatch) {

Only does full comparison if first 4 bytes match.

I think I'll go fishing now.   Wink

faster  Wink