Git Product home page Git Product logo

murmurhash-net's Introduction

An implementation of the Murmur3 hash for .NET

As of the time this was written, this library supports the 3 main Murmur3 variants: 32-bit hash (x86), 128-bit hash (x86) and 128-bit hash (x64). The variants are implemented as HashAlgorithm implementations, so that they can be transparently swapped out with any other .NET framework algorithms. For each algorithm, there is a managed and unmanaged (rather, unsafe) variant that you can pick when creating the algorithm.

There currently is not a way to force the selection of a 128-bit algorithm right now, but it automatically detects the process type and returns the optimized algorithm.

You can grab the the binaries off of nuget and there is also a signed package if that's your thing.

Example

byte[] data = Guid.NewGuid().ToByteArray();
HashAlgorithm murmur128 = MurmurHash.Create128(managed: false); // returns a 128-bit algorithm using "unsafe" code with default seed
byte[] hash = murmur128.ComputeHash(data);

// you can also use a seed to affect the hash
HashAlgorithm seeded128 = MurmurHash.Create128(seed: 3475832); // returns a managed 128-bit algorithm with seed
byte[] seedResult = murmur128.ComputeHash(data);

License

Apache 2.0, but only to the extent of the actual code here. I didn't invent the Murmur[3] algorithm nor do I really understand it, I just ported it as best I could to c#. I picked Apache 2.0 because I want others to benefit from the work here, but not necessarily be able to "sell" the library itself (i.e. the compiled dll), but you are completely fine to use the library in commercial projects. I'm not a lawyer, so if you see a problem with the license, let me know and I'll fix it.

murmurhash-net's People

Contributors

darrenkopp avatar jwaimann avatar sharpseeer avatar scovetta avatar

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.