Vish <vahuja4 at gmail.com> writes: > I need to hash 3d coordinates to a grid which has been divided into > 4*4*4 squares. Using python, I thought of a simple way as follows: Use the built-in hash function: >>> p = (1, 2, 3) >>> print hash(p) 2528502973977326415 You can of course mod that by the table size: >>> print hash(p) % (4*4*4) 15