Hash string function that keeps compare properties
-
Is there a hash string function that preserves the capability to compare two strings just by comparing their respective hash values ? Currently, I have to perform a full Str.Compare("other string") in order to sort them. I had also calculated their hash value, but the sorting (Quick Sort, Bubble Sort, whatever...) fails using the hash value. The hash value is mostly random, especially on long strings. Comparing the hash values (int) would have been quite faster, I have to perform the quickest sort possible on text files larger than 100 MB ! So please don't come with CString as a solution. It works, but asks hours to do the job. CString is perfect to manipulate UI strings, but bad for heavy duty purposes... So, to sum up, it there a good hash function that will allow : "Minus string" < "Plus string" HASH("Minus string") < HASH("Plus string") Kochise In Code we trust !