-1

Let's say I have a structure like this,

struct point3d{ int x; int y; int z; }; 

How can I create a hash value from this structure? Thanks

5

1 Answer 1

-1

A lot depends on what you want to achieve and how much distribution you need.

Most non-cryptographic hash would be similar to :

int64_t Hash(const point3d & point){ int64_t start = 1234; //magic number int64_t multiplier = 3467; //some other magic number int64_t hash = start + point.x; hash = hash*multiplier + point.y; hash = hash * multiplier + point.z; return hash; } 

Test this out on your data set by tuning start and multiplier.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.