Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add a mode to score the result based on the number of zero-bytes #35

Open
0xSynon opened this issue Feb 18, 2024 · 0 comments

Comments

@0xSynon
Copy link

0xSynon commented Feb 18, 2024

Currently with the option --zeros this address the program scores a result higher if it has more characters zero even if there are fewer zero bytes. Example:

  Time:     0s Score: 13 Private: 0x... Contract: 0xcc00a0c121016f0d000e7a740fada0bd0066086f
  Time:     1s Score: 14 Private: 0x... Contract: 0x400ab2800f0032900f00a1d0580630846044557b
  Time:     1s Score: 15 Private: 0x... Contract: 0xc0e250000ad20bf5d079a002003fe900c00d1e32
  Time:     2s Score: 16 Private: 0x... Contract: 0x9afd138054000005209086700005c9b0007c1908
  Time:     3s Score: 17 Private: 0x... Contract: 0x07a316d0f0eb0900090002606080d00d093c4045

In zero-byte mode, the scores for these results would be

  • Score: 3 -- 0xcc 00 a0 c1 21 01 6f 0d 00 0e 7a 74 0f ad a0 bd 00 66 08 6f
  • Score: 2 -- 0x40 0a b2 80 0f 00 32 90 0f 00 a1 d0 58 06 30 84 60 44 55 7b
  • Score: 3 -- 0xc0 e2 50 00 0a d2 0b f5 d0 79 a0 02 00 3f e9 00 c0 0d 1e 32
  • Score: 4 -- 0x9a fd 13 80 54 00 00 05 20 90 86 70 00 05 c9 b0 00 7c 19 08
  • Score: 2 -- 0x07 a3 16 d0 f0 eb 09 00 09 00 02 60 60 80 d0 0d 09 3c 40 45

I don't know OpenCL at all but I tried to change the profanity_score_matching function like this:

__kernel void profanity_score_matching(__global mp_number * const pInverse, __global result * const pResult, __constant const uchar * const data1, __constant const uchar * const data2, const uchar scoreMax) {
    const size_t id = get_global_id(0);
    __global const uchar * const hash = pInverse[id].d;
    int score = 0;

    for (int i = 0; i < 20; ++i) {
        if (hash[i] == 0) {       // <---- here
            ++score;
        }
    }

    profanity_result_update(id, hash, pResult, score, scoreMax);
}

But it didn't change anything. I'm probably modifying the wrong function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant