2002-07-07 06:23:41+0200, Joakim Axelsson <[EMAIL PROTECTED]> -> > > res = ((key->sip & 0xF0F0F0F0) >> 4) | ((key->sip & 0x0F0F0F0F) << 4); > res *= 0x47441DFB; > res ^= key->dip ^ key->proto; > res ^= (key->dport << 16) ^ key->sport; > res *= 0x57655A7D; > res ^= (res >> 24); > res ^= (res >> 8); > > I think this solution will make the two random constanst enough independent > to make it impossible to attack one, any, bucket. Better solutions on the > two constants are welcome. >
It can still be calculated backwards to attack i think. However leting one constant multiply (the first) and one xor should make it harder to attack one any bucket. It even gives a slightly better distribution and removing one muliplication is good. I also made an or of the ports. Makes no difference but in reading. res = ((key->sip & 0xF0F0F0F0) >> 4) | ((key->sip & 0x0F0F0F0F) << 4); res *= 0x47441DFB; res ^= key->dip ^ key->proto; res ^= ((key->dport << 16) | key->sport); res ^= 0x57655A7D; res ^= (res >> 24); res ^= (res >> 8); Now someone else have to take a look at it. I digged my head into a corner. -- /Joakim Axelsson A.K.A Gozem@EFnet & OPN