Hashing 2D, 3D and nD vectors

There’s a spatial hash function described in Optimized Spatial Hashing for Collision Detection of Deformable Objects. They use the hash function hash(x,y,z) = ( x p1 xor y p2 xor z p3) mod n where p1, p2, p3 are large prime numbers, in our case 73856093, 19349663, 83492791, respectively. The value n is the hash …

Read more

Can CRC32 be used as a hash function?

CRC32 works very well as a hash algorithm. The whole point of a CRC is to hash a stream of bytes with as few collisions as possible. That said, there are a few points to consider: CRC’s are not secure. For secure hashing you need a much more computationally expensive algorithm. Different CRC flavors exist …

Read more