Code Monkey home page Code Monkey logo

Comments (4)

leventov avatar leventov commented on June 18, 2024

We can't figure out how to have the python implementation find the same key for LongHashFunction.xx().hashChars("test")

You probably need to encode a string in UTF-16, because that's what essentially the Java's character arrays are. Also would need byte order, though.

from zero-allocation-hashing.

drummerwolli avatar drummerwolli commented on June 18, 2024

anyone been able to provide this? we would be interested in this as well.

from zero-allocation-hashing.

anzecesar avatar anzecesar commented on June 18, 2024

We had the same issue, except with nodejs.

In the end what produced the same hash was:

LongHashFunction.xx(123).hashBytes("teststring".getBytes("UTF-8"))

and in nodejs:

const hash = XXHash.hash64(Buffer.from('teststring', 'utf-8'), 123);
const hashValue = hash.readBigUInt64LE();

I hope this helps someone in the future.

from zero-allocation-hashing.

gzm55 avatar gzm55 commented on June 18, 2024

This should not be an issue.

the default encoding in different languages are not same. to get the same hash result, the binary layout of the input must be exactly same, so select a well defined encoding codec before hash.

from zero-allocation-hashing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.