Re: Q: How to test new hash algorithm?

Martin Hvidberg wrote:

That makes sence... I guess an optimal hash would change all allong the output string (or change all the digits) if you change just a singel char in the input.

Not at all. Changing all of the bits is exactly the same as not changing anything -- with an "optimal" hash function, any change at all in the input, including a change in just *one bit* of the input produces an output that is statistically uncorrelated to the former; when you think about it, in average you would expect *half* of the output bits to change.

Regardless of how "non-fancy" your requirements are, I would
*strongly* suggest that you go for something standard, even if
a simple CRC, as already suggested.

You could check Wikipedia for a description (in "pseudo-Pascal")
of hashes like SHA-1 or MD5.

I wonder if a SHA algorithm with fewer rounds (so that you can
code something more efficient) would fit the bill of having the
right statistical properties even if it sacrifices strength
against cryptanalysis (which seems to be of no concern for you).
I will leave that one for the experts out here.



Relevant Pages

  • Re: To combine string and integer in F90
    ... and blanks were placed in the output string before the digits. ... pad the output string with leading zeros, at least for F90 and later. ...
  • Re: Number to Words..
    ... > string words = ConvertToWords; ... the number of digits to the left of the decimal point is 7) and convert it ... suffixed with " hundred" to your output string. ... our American friends!) ...
  • Re: Cryptographic Hash function
    ... always produces a fixed length string as output. ... mean that the output string will always be longer than the ... The hash function generally does not care about the length ... So yes, collisions are bound to be a mathematical possibility, ...