Hard-code a random constant as upb's hash seed

This is a step toward randomizing upb's map ordering, which is currently
deterministic.

PiperOrigin-RevId: 721030827
pull/20151/head
Adam Cozzette 4 weeks ago committed by Copybara-Service
parent 91f1700852
commit 26148bedcf
  1. 6
      upb/hash/common.c

@ -402,8 +402,12 @@ uint32_t _upb_Hash(const void* p, size_t n, uint64_t seed) {
return Wyhash(p, n, seed, kWyhashSalt);
}
// Returns a seed for upb's hash function. For now this is just a hard-coded
// constant, but we are going to randomize it soon.
static uint64_t _upb_Seed(void) { return 0xdff497e08889bf61; }
static uint32_t _upb_Hash_NoSeed(const char* p, size_t n) {
return _upb_Hash(p, n, 0);
return _upb_Hash(p, n, _upb_Seed());
}
static uint32_t strhash(upb_tabkey key) {

Loading…
Cancel
Save