H
H
hardwellZero2015-03-17 19:04:57
Python
hardwellZero, 2015-03-17 19:04:57

How to implement XOR hashing?

Hello.
It is necessary to implement the simplest hash function using XOR operations using randomization. (16 bits)
I am familiar with the XOR algorithm, but I still do not understand the task.
Is it something to do with sha1?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Martyanov, 2015-03-17
@vilgeforce

Hash and randomization? All right? A hash function should give the same result for the same data, right?

A
asd111, 2015-03-18
@asd111

short int hash(short int h) {    
    h ^= (h >> 10) ^ (h >> 6);
    return h ^ (h >> 4) ^ (h >> 2);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question