1

I need to compute a hash of an identifier string that looks something like 00000E11002F68FF21B459BFA33A1BFCB50E0070011167CCBF9AD994E8AAE2BFEBEEE17EC00000000010C000011167CCBF9AD994E8AAE2BFEBEEE17EC0000F083227C000000000000E11002F68FF21B459BFA33A1.

I am going to use the hash as a filename that among other things will store the identifier code as I don't want to use such a long string a file name. The hash doesn't need be absolutely unique as I can just append an iterator onto the filename in the case there is collision but at the same time I don't want two many collisions as its inefficient to open multiple files to check for an exact match.

Is the String.GetHashCode()good enough for this purpose? I could have a few hundred files in the directory at one time.

Shane
  • 2,271
  • 3
  • 27
  • 55
  • 1
    `String.GetHashCode()` can not be relied upon to work the same between different runtime versions or even just between different processes. – kalimag Mar 06 '19 at 03:24
  • Just create a MD5 hash and fold it down in size with XOR and then base 64 it. – Enigmativity Mar 06 '19 at 08:01

0 Answers0