Differences From 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...]
To Artifact [6b2bc955be]:
- File
src/macros.h
— part of check-in
[4857107479]
at
2012-12-06 11:00:54
on branch trunk
— OFMapTable: Rotate hash by a random number of bits
By rotating the hash by a random number of bits, an attacker needs to
find collisions on the full 32 bits of the hash and not only on the
lower n bits that are actually used by the map table, as an attacker
can't know which bits are actually used for the map table. (user: js, size: 9039) [annotate] [blame] [check-ins using]
︙ | |||
321 322 323 324 325 326 327 328 329 330 331 332 333 334 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | + + + | #if defined(__MACH__) && defined(__arm__) # define OF_IOS #endif #define OF_ROL(value, bits) \ (((value) << ((bits) % (sizeof(value) * 8))) | \ (value) >> (sizeof(value) * 8 - ((bits) % (sizeof(value) * 8)))) #define OF_ROR(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); \ |
︙ |