Google FarmHash Bindings for Python


Keywords
farmhash, google
License
MIT
Install
pip install pyfarmhash==0.3.2

Documentation

python-farmhash

Overview

This package provides bindings for the Google's FarmHash.

Code specific to this project is covered by The MIT License

Forked on 2015.04.06 to add bindings for fingerprint functions. Pull request submitted.

Install

Update: Windows binary wheel uploaded to pypi

Currently, clone the repo and:

pip(Linux & Windows):

$ sudo pip install pyfarmhash

From Source:

$ cd python-farmhash
$ sudo python setup.py Install

You need g++ installed.

Windows: (Sheer hackery. I'm sure there's a way to do this with the new VS but this is working and I don't have hours to work on it. Feel free to submit a pull request)

Install Microsoft Visual C++ Compiler for Python 2.7 http://www.microsoft.com/en-us/download/details.aspx?id=44266 Install msinttypes https://code.google.com/p/msinttypes/ Copy stdint.h to the src directory, and modify the farmhash.cc line 47 reference to use double quotes instead of angle brackets Add "if defined(_MSC_VER) ||" to line 76 of farmhash.cc $ cd python-farmhash $ sudo python setup.py install

Usage

The library is pretty simple to use:

import farmhash
print farmhash.hash64('abc')
2640714258260161385

For more details, use ipython:

In [1]: import farmhash

In [2]: farmhash.hash64withseed?
Type: builtin_function_or_method
String Form:
Docstring:
Hash function for a string. For convenience, a 64-bit seed is also hashed into the result.
example: print farmhash.hash64withseed('abc', 12345)
13914286602242141520L