Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.
This repository was archived by the owner on May 13, 2022. It is now read-only.

xxHash sometimes doesn't match the Hash from the C library from Google #16

Closed

Description

@illcom94

I need to be able to verify an xxHash64 that is being generated by another program. Sometimes the xxHash from this code doesn't match, and when I run the C code downloaded from google, it does.
https://code.google.com/p/xxhash/

Has anyone else had this issue?

Activity

  1. illcom94 commented on Aug 20, 2015

    @illcom94
    Author

    I stepped through the code along with the C++ code from google and I've found the issue.
    xxHash.cs

    1. In ComputeHashInternal() the dataCount variable should be a long instead of an int. On large files, it overflows into negative.
    2. In PostProcess() you have an if statement "if ((remainder.Length % 8) > 4)" this ensures that your code for processing the last 4 bytes of a file will never be hit. It should be changed to " if ((remainder.Length % 8) == 4)".

    After these two changes, everything seems to match.

  2. illcom94 commented on Aug 20, 2015

    @illcom94
    Author

    After running a few more files I had to make a modification to my #2 fix.
    The if statement should be "if ((remainder.Length % 8) >= 4)"

  3. brandondahler commented on Aug 31, 2015

    @brandondahler
    Owner

    I'll take a look at as soon as I can. If you know how to submit a pull request with the changes you talked about above, it could significantly help expedite the process.

  4. added 3 commits that reference this issue on Sep 5, 2015
  5. added a commit that references this issue on Sep 27, 2015
  6. brandondahler commented on Sep 27, 2015

    @brandondahler
    Owner

    This issue has been addressed in release 1.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址