Uploaded image for project: 'Celix'
  1. Celix
  2. CELIX-391

The utils_stringHash does not generate unique hashes.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      The utils_stringHash function is generating the same id for a set of different strings.

      The following code can be used (the DJB2 Hash algorithm):
      --------------------------------------------
      unsigned int hc = 5381;
      char ch;
      while((ch = *string++) != '\0') {
      hc = (hc << 5) + hc + ch;
      }
      return hc;
      ---------------------------------------------
      See: http://www.cse.yorku.ca/~oz/hash.html

      Attachments

        1. utils_stringHash bug.png
          10 kB
          Roy Lenferink

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rlenferink Roy Lenferink
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: