Giter Club home page Giter Club logo

Comments (5)

rurban avatar rurban commented on July 18, 2024

wyhash.h:

static void wyhash_seed_init(uint32_t &seed) {
  static const uint32_t bad[]
      = { 0x1b8fe073, 0x1fe1e0ed, 0x22e4e037, 0x2dbb9275, 0x2f3d0bb5,
          0x2ffdf2b3, 0x3e4fbb13, 0x3f7d67b9, 0x41edfd1f, 0x4f119b24,
          0x54f9f25f, 0x556f8cfe, 0x5898c767, 0x656de51a, 0x67e7b210,
          0x6dc72c49, 0x72e07c2d, 0x7519ebfb, 0x7b6316c3, 0x84970155,
          0x869e000a, 0x8bca8721, 0x8eb79e39, 0x923a154e, 0x976c10a7,
          0x998ff92a, 0xa1d39054, 0xa890a461, 0xa99e8824, 0xae474ec3,
          0xb79bb6d6, 0xb849c5a7, 0xb9e9f2ed, 0xbdf0469e, 0xc9277d58,
          0xcc1ff38c, 0xcf327745, 0xd0de0b07, 0xd2a09b99, 0xd304cf19,
          0xe10fc175, 0xe519e35e, 0xed698d7a, 0xfb180c1e, 0xff09c242 };
  for (auto s : bad)
    if (seed & s)
        seed++;
}
static void wyhash32low_seed_init(uint32_t &seed) {
  static const uint32_t bad[] = {
    0x10027575, 0x1b8fe073, 0x1fe1e0ed, 0x22e4e037, 0x270c37d9, 0x2dbb9275,
    0x2f3d0bb5, 0x2ffdf2b3, 0x3e4fbb13, 0x3f7d67b9, 0x41edfd1f, 0x4f119b24,
    0x54f9f25f, 0x556f8cfe, 0x5898c767, 0x656de51a, 0x67e7b210, 0x6dc72c49,
    0x72e07c2d, 0x7519ebfb, 0x7b6316c3, 0x81430696, 0x847c31ec, 0x84970155,
    0x869e000a, 0x8bca8721, 0x8eb79e39, 0x923a154e, 0x976c10a7, 0x998ff92a,
    0x9cc49b0e, 0xa1d39054, 0xa890a461, 0xa99e8824, 0xae474ec3, 0xb79bb6d6,
    0xb849c5a7, 0xb9e9f2ed, 0xbdf0469e, 0xc9277d58, 0xcc1ff38c, 0xcf327745,
    0xd0de0b07, 0xd2a09b99, 0xd304cf19, 0xd6280a9f, 0xd7a19c7c, 0xd904642b,
    0xe10fc175, 0xe3a241d2, 0xe519e35e, 0xea4e9ede, 0xeaf05b3d, 0xed698d7a,
    0xfb180c1e, 0xff09c242
  };
  for (auto s : bad)
    if (seed == s)
        seed++;
}

wyhash32.h:

// This version is vulnerable when used with a few bad seeds, which should be
// skipped beforehand: 0x51a43a0f, 0x522235ae, 0x99ac2b20
#ifdef __cplusplus
static void wyhash32_seed_init(uint32_t &seed) {
  if ((seed == 0x51a43a0f) || (seed == 0x522235ae) || (seed == 0x99ac2b20))
    seed++;
}
#endif

from wyhash.

wangyi-fudan avatar wangyi-fudan commented on July 18, 2024

I didn't notice this test (with --extra). Now latest version completely solved BadSeeds problem. Please try again.

from wyhash.

rurban avatar rurban commented on July 18, 2024

That was fast!

from wyhash.

mengzhuo avatar mengzhuo commented on July 18, 2024

I tried run newer v4 and it looks good.

--- Testing wyhash "wyhash v4 (64-bit)" GOOD

[[[ BadSeeds Tests ]]]

Testing 45 internal secrets:
0x1b8fe073 0x1fe1e0ed 0x22e4e037 0x2dbb9275 0x2f3d0bb5 0x2ffdf2b3 0x3e4fbb13 0x3f7d67b9 0x41edfd1f 0x4f119b24 0x54f9f25f 0x556f8cfe 0x5898c767 0x656de51a 0x67e7b210 0x6dc72c49 0x72e07c2d 0x7519ebfb 0x7b6316c3 0x84970155 0x869e000a 0x8bca
8721 0x8eb79e39 0x923a154e 0x976c10a7 0x998ff92a 0xa1d39054 0xa890a461 0xa99e8824 0xae474ec3 0xb79bb6d6 0xb849c5a7 0xb9e9f2ed 0xbdf0469e 0xc9277d58 0xcc1ff38c 0xcf327745 0xd0de0b07 0xd2a09b99 0xd304cf19 0xe10fc175 0xe519e35e 0xed698d7a 0
xfb180c1e 0xff09c242 PASS
Testing the first 0xffffffff seeds ...
4 threads starting...
at 0 at 80000000 at 40000000 at c0000000 c1ffffff 1ffffff 41ffffff 81ffffff c3ffffff 3ffffff 83ffffff 43ffffff c5ffffff 5ffffff 85ffffff 45ffffff c7ffffff 7ffffff 87ffffff 47ffffff c9ffffff 9ffffff 89ffffff 49ffffff cbffffff 8bffffff bff
ffff 4bffffff cdffffff 8dffffff dffffff 4dffffff cfffffff 8fffffff fffffff 4fffffff d1ffffff 91ffffff 11ffffff 51ffffff d3ffffff 93ffffff 13ffffff 53ffffff d5ffffff 95ffffff 15ffffff 55ffffff d7ffffff 97ffffff 17ffffff 57ffffff d9ffffff
99ffffff 19ffffff 59ffffff dbffffff 9bffffff 1bffffff 5bffffff ddffffff 9dffffff 1dffffff 5dffffff dfffffff 9fffffff 1fffffff 5fffffff e1ffffff a1ffffff 21ffffff 61ffffff a3ffffff e3ffffff 23ffffff 63ffffff a5ffffff e5ffffff 25ffffff 65f
fffff a7ffffff e7ffffff 27ffffff 67ffffff a9ffffff e9ffffff 29ffffff 69ffffff abffffff ebffffff 2bffffff 6bffffff adffffff 2dffffff edffffff 6dffffff afffffff efffffff 2fffffff 6fffffff b1ffffff 31ffffff f1ffffff 71ffffff b3ffffff 33ffff
ff f3ffffff 73ffffff b5ffffff f5ffffff 35ffffff 75ffffff b7ffffff f7ffffff 37ffffff 77ffffff b9ffffff f9ffffff 39ffffff 79ffffff 3bffffff fbffffff bbffffff 7bffffff fdffffff 3dffffff bdffffff 7dffffff ffffffff 3fffffff bfffffff 7fffffff
All 4 threads ended
PASS

from wyhash.

rurban avatar rurban commented on July 18, 2024

Yes, wyhash is now perfect, the 32bit hashes still have a few.
I added a PR to check for these.

from wyhash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.