Skip to content

GTuritto/city-hash-net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CityHash

.NET wrapper for Google's City Hash family of hash functions (http://code.google.com/p/cityhash/).

Usage

This library exposes the City Hash functions as string extension methods. Add the CityHash.dll as a reference to your .NET project, and place the CityHash.Win32.dll in a directory that your application can find.

using CityHash;

.
.
.

string someString = "some string";

// Generating a 32-bit hash
someString.GetCityHash32(); //returns 805573804

// Generating a 64-bit hash
someString.GetCityHash64(); //returns 9651795998918897910

// Generating a 64-bit hash with a seed
someString.GetCityHash64(1234); //returns 2539580409082155169

// Generating a 64-bit hash with two seeds
someString.GetCityHash64(1234, 5678); //returns 5233622152544161018

Source Overview

The solution currently consists of the following projects:

CityHash.Win32 - Port of the original CityHash source code to Win32

CityHash - Wrapper library that P/Invokes CityHash.Win32.dll for use in .NET

CityHash.Tests - Unit tests

TODO

  • Implement Hash128 and Hash128WithSeed
  • Eliminate CityHash.Win32.dll dependancy
  • Create NuGet package

Contributing

Contributions and feedback are more than welcome. Just fork, push, and send a pull request.

About

.NET wrapper for Google's City Hash family of hash functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published