{"id":16330077,"url":"https://github.com/rmax/yammh3","last_synced_at":"2025-04-04T11:02:10.771Z","repository":{"id":46352735,"uuid":"61342860","full_name":"rmax/yammh3","owner":"rmax","description":"Yet another Murmurhash3 bindings.","archived":false,"fork":false,"pushed_at":"2023-01-11T16:48:19.000Z","size":53,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T19:18:52.984Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmax.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-17T03:26:12.000Z","updated_at":"2023-07-15T07:34:47.000Z","dependencies_parsed_at":"2023-02-09T03:45:31.482Z","dependency_job_id":null,"html_url":"https://github.com/rmax/yammh3","commit_stats":null,"previous_names":["rolando/yammh3"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmax%2Fyammh3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmax%2Fyammh3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmax%2Fyammh3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmax%2Fyammh3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmax","download_url":"https://codeload.github.com/rmax/yammh3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166159,"owners_count":20894653,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T23:18:26.518Z","updated_at":"2025-04-04T11:02:10.749Z","avatar_url":"https://github.com/rmax.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"===============================\nYet Another Murmurhash3 Binding\n===============================\n\n.. image:: https://img.shields.io/pypi/v/yammh3.svg\n        :target: https://pypi.python.org/pypi/yammh3\n\n.. image:: https://img.shields.io/travis/rolando/yammh3.svg\n        :target: https://travis-ci.org/rolando/yammh3\n\n.. image:: https://readthedocs.org/projects/yammh3/badge/?version=latest\n        :target: https://readthedocs.org/projects/yammh3/?badge=latest\n        :alt: Documentation Status\n\n\nPython/Cython Murmurhash3 binding.\n\n* Free software: MIT license\n* Documentation: https://yammh3.readthedocs.org.\n\nFeatures\n--------\n\n* Provides a high-level Python API.\n* Provides a low-level Cython binding.\n* Python 2 and 3 support.\n\nExample\n-------\n\nHere is an example in Python:\n\n.. code:: python\n\n  from yammh3 import hash64\n\n  key = b\"yammh3!\"\n\n  # hash* functions return a signed integer by default.\n  print(\"signed 64 bits hash is %s\" % hash64(key))  # -\u003e -1339990020854215562\n  print(\"unsigned 64 bits hash is %s\" % hash64(key, signed=False))  # -\u003e 17106754052855336054L\n\n\nIn Cython, first we need to write a ``.pyx`` file with our code:\n\n.. code:: cython\n\n    # file: yammh3_example.pyx\n    # mhash* functions are only available via cimport.\n    from yammh3._yammh3 cimport mhash64, mhash64s\n    from yammh3._yammh3 cimport int64_t, uint64_t, uint32_t\n\n    def print_hashes(bytes key):\n        cdef uint64_t h1\n        cdef int64_t h2\n        cdef uint32_t n = len(key)\n        cdef char *c_key = \u003cchar *\u003ekey\n\n        with nogil:  # releasing the GIL!\n            h1 = mhash64(c_key, n)\n            h2 = mhash64s(c_key, n)\n\n        print(\"unsigned 64 bits hash is %d\" % h1)\n        print(\"signed 64 bits hash is %d\" % h2)\n\n\nWe need to compile it as a module, usually by using a setup script:\n\n.. code:: python\n\n    # file: setup.py\n    from setuptools import setup\n    from setuptools.extension import Extension\n    from Cython.Build import cythonize\n\n    import yammh3  # already installed\n\n    setup(\n        name='yammh3-example',\n        ext_modules=cythonize([\n            Extension('*', ['*.pyx'], include_dirs=[yammh3.get_include()]),\n        ])\n    )\n\n\nThen we build the modules in-place:\n\n.. code::\n\n    $ python setup.py build_ext --inplace\n    Running build_ext\n    building 'yammh3_example' extension\n    ... [snip] ...\n    copying build/lib.macosx-10.5-x86_64-2.7/yammh3_example.so -\u003e\n\n\nNow we are ready to run our code:\n\n.. code::\n\n    $ python -c 'import yammh3_example; yammh3_example.print_hashes(b\"yammh3!\")'\n    unsigned 64 bits hash is 17106754052855336054\n    signed 64 bits hash is -1339990020854215562\n\n\nCredits\n---------\n\nMurmurhash3 was originally created by `Austin Appleby`_.\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n.. _`Austin Appleby`: https://github.com/aappleby/smhasher\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmax%2Fyammh3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmax%2Fyammh3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmax%2Fyammh3/lists"}