As a general case of Oli Charlesworth's solution, you can select coprime with 256 and pre-multiply each byte from your input by that value and then XOR all values together. You'll still get uniform distribution, but for sequential inputs you'll get non-sequential output, for instance.
As a general case of Oli Charlesworth's solution, you can select coprime with 256 and pre-multiply each byte from your input by that value and then XOR all values together. You'll still get uniform distribution, but for sequential inputs you'll get non-sequential output, for instance: byte result = 0; int q = 33149; foreach (byte be in BitConverter. GetBytes(input)) result += (byte)(b * q); For 1, 2, 3, 4, 5, 6, ... it will get you 125, 250, 119, 244, 113, 238, etc.
1 for going one step further! – Daniel MoÅ¡mondor Dec 17 at 17:34 My answer will also give non-sequential output. – Oli Charlesworth Dec 17 at 17:47 Agreed, starting from 256 your version will also get non-sequential results and for values greater than a few thousands it'll also 'look random'.
– MagnatLU Dec 17 at 17:52.
Lacking any further information or constraints, one possibility is just to bitwise-XOR all of the 8 bytes together. This will be uniform for a uniform input. My C# is rusty, but in pseudocode: byte hash = 0; for (int I = 0; I > (i*8)); }.
There's no uint8, use byte instead ;) – digEmAll Dec 17 at 16:58 @digEmAll: Thanks! – Oli Charlesworth Dec 17 at 16:58.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.