Giter Site home page Giter Site logo

cityhash-for-java's People

Contributors

tamtam180 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cityhash-for-java's Issues

Result inconsist with python cityhash64

I have try to use this cityhash64 func, but find out the result is inconsist. Can u please take a look.

from cityhash import CityHash32, CityHash64, CityHash128

print(CityHash64('abc'))
print(CityHash64('123'))
    public static void main(String[] args) {
        String itemId = "123";
        byte[] bytes = itemId.getBytes(StandardCharsets.UTF_8);

        for (int i = 0; i < bytes.length; i++) {
            System.out.println(bytes[i]);
        }

        System.out.println(toUnsignedString(cityHash64(itemId.getBytes(), 0, itemId.length())));
        System.out.println(toUnsignedString(cityHash64("abc".getBytes(), 0, itemId.length())));
    }

Defination of parameter "pos" in function cityHash64WithSeed

Regarding below function cityHash64WithSeed,
public static long cityHash64WithSeed(byte[] s, int pos, int len, long seed)
May I know why it has addtional parameter "pos" comparing with one in C++ ?
And what is the purpose of "pos"?

Below is original C++ code of this function for your information:
uint64 CityHash64WithSeed(const char *s, size_t len, uint64 seed) {
return CityHash64WithSeeds(s, len, k2, seed);
}

thanks a lot.

This implementation is compatible to the 1.0.0 implementation version.

original 1.0.0 / at Apr 6, 2011: google/cityhash@6efae23
And my code committed at Apr 6, 2012.

After then, the original implementation has been upgraded several times and the hash value has changed.

Histories:

  • CityHash v1, April 11, 2011 <= this code as same
  • CityHash v1.0.1, April 28, 2011
  • CityHash v1.0.2, May 8, 2011
  • CityHash v1.0.3, October 6, 2011
  • CityHash v1.1, October 22, 2012

see: https://github.com/google/cityhash/blob/master/NEWS

Note which version of the implementation is compatible.

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.