Differences From Artifact [419a2f32d2]:
- File
src/macros.h
— part of check-in
[f60e4012b7]
at
2012-12-04 09:19:58
on branch trunk
— Randomize hashes.
This prevents DoSing hashtables by creating conflicts deliberately. (user: js, size: 8880) [annotate] [blame] [check-ins using]
To Artifact [ba733f14be]:
- File src/macros.h — part of check-in [ac51f5f0cf] at 2012-12-06 00:14:47 on branch trunk — Improve -[hash] of OFNumber and OFObject. (user: js, size: 8886) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
323 324 325 326 327 328 329 | #endif #define OF_ROL(value, bits) \ (((value) << ((bits) % (sizeof(value) * 8))) | \ (value) >> (sizeof(value) * 8 - ((bits) % (sizeof(value) * 8)))) #define OF_HASH_INIT(hash) hash = of_hash_seed | | | | | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | #endif #define OF_ROL(value, bits) \ (((value) << ((bits) % (sizeof(value) * 8))) | \ (value) >> (sizeof(value) * 8 - ((bits) % (sizeof(value) * 8)))) #define OF_HASH_INIT(hash) hash = of_hash_seed #define OF_HASH_ADD(hash, byte) \ { \ hash += (uint8_t)(byte); \ hash += (hash << 10); \ hash ^= (hash >> 6); \ } #define OF_HASH_FINALIZE(hash) \ { \ hash += (hash << 3); \ hash ^= (hash >> 11); \ hash += (hash << 15); \ } |
︙ | ︙ |