celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CELIX-391) The utils_stringHash does not generate unique hashes.
Date Thu, 12 Jan 2017 07:53:52 GMT

    [ https://issues.apache.org/jira/browse/CELIX-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15820414#comment-15820414
] 

ASF GitHub Bot commented on CELIX-391:
--------------------------------------

GitHub user rlenferink opened a pull request:

    https://github.com/apache/celix/pull/13

    CELIX-391: Fix for utils_stringHash

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rlenferink/celix develop

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/celix/pull/13.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #13
    
----
commit 3824cfc3d5bc6fd0b20c284eed3164294ad5a92c
Author: Roy Lenferink <lenferinkroy@gmail.com>
Date:   2017-01-12T07:51:39Z

    CELIX-391: Fix for utils_stringHash

----


> The utils_stringHash does not generate unique hashes.
> -----------------------------------------------------
>
>                 Key: CELIX-391
>                 URL: https://issues.apache.org/jira/browse/CELIX-391
>             Project: Celix
>          Issue Type: Bug
>            Reporter: Roy Lenferink
>            Priority: Minor
>         Attachments: utils_stringHash bug.png
>
>
> 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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message