{"id":15343702,"url":"https://github.com/spacewander/lua-resty-murmurhash3","last_synced_at":"2025-04-15T03:31:50.585Z","repository":{"id":71091887,"uuid":"98725208","full_name":"spacewander/lua-resty-murmurhash3","owner":"spacewander","description":"The Lua binding of murmurhash3 via LuaJIT FFI","archived":false,"fork":false,"pushed_at":"2018-05-31T16:31:28.000Z","size":12,"stargazers_count":20,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T08:33:41.595Z","etag":null,"topics":["hash","luajit","murmurhash","murmurhash3","openresty"],"latest_commit_sha":null,"homepage":"","language":"C++","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/spacewander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-29T10:20:32.000Z","updated_at":"2024-09-06T05:56:09.000Z","dependencies_parsed_at":"2023-03-11T09:53:43.095Z","dependency_job_id":null,"html_url":"https://github.com/spacewander/lua-resty-murmurhash3","commit_stats":{"total_commits":11,"total_committers":3,"mean_commits":"3.6666666666666665","dds":"0.18181818181818177","last_synced_commit":"23648524d84955140b0e9c87a85af75c8bdf4453"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flua-resty-murmurhash3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flua-resty-murmurhash3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flua-resty-murmurhash3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacewander%2Flua-resty-murmurhash3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacewander","download_url":"https://codeload.github.com/spacewander/lua-resty-murmurhash3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223657852,"owners_count":17181024,"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":["hash","luajit","murmurhash","murmurhash3","openresty"],"created_at":"2024-10-01T10:49:03.114Z","updated_at":"2024-11-08T09:04:24.585Z","avatar_url":"https://github.com/spacewander.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"## Name\n\nlua-resty-murmurhash3 - the Lua binding of murmurhash3 via LuaJIT FFI\n\n## Status\n\n[![Build Status](https://travis-ci.org/spacewander/lua-resty-murmurhash3.svg?branch=master)](https://travis-ci.org/spacewander/lua-resty-murmurhash3)\n\n## When should I use it?\n\nMurmurhash family has an awesome feature, it could hash data into a few bytes with fantasy speed.\nThe feature is useful when you want to count urls or anything similar.\n\nCompared with Murmurhash2, Murmurhash3 has improved the collision resistance.\nIt also supports to provide 128 bits output.\n\nSometimes you don't need to use cryptographic hashes like MD5. They are relatively slow.\n\nHere is a non-scientific benchmark comparing Murmurhash2/Murmurhash3/MD5:\n\n---\nTime used in processing 1e6 random generated 256 byte string:\n* Murmurhash2(lua-resty-murmurhash2): 0.295s\n* Murmurhash3(lua-resty-murmurhash3): 0.265s\n* Murmurhash3, 128 bits(lua-resty-murmurhash3): 0.155s\n* MD5(ngx.md5_bin): 1.585s\n\n---\n\nMurmurhash3(128 bits) is faster than Murmurhash3(32 bits) because of the modern processor's 64-bit multipliers and superscalar architecture.\n\n## Synopsis\n\n```lua\nlocal mmh3 = require \"murmurhash3\"\nlocal murmurhash3 = mmh3.murmurhash3\nlocal murmurhash3_128 = mmh3.murmurhash3_128\nlocal ts = {}\nfor _ = 1, 256 do\n    table.insert(ts, math.random(65, 122))\nend\nlocal s = table.concat(ts)\nlocal data\nlocal start = ngx.now()\nfor _ = 1, 1e6 do\n    data = murmurhash3(s)\n    --data = murmurhash3_128(s)\nend\nngx.update_time()\nngx.say(ngx.now() - start)\nngx.say(data)\n```\n\n## Methods\n\nmurmurhash3\n---\n`syntax: hash = mmh3.murmurhash3(string[, seed])`\n\nGenerate 32 bits hash from given string, with an optional seed(default 0).\nThe returned result is an unsigned integer represented by a Lua number.\n\nmurmurhash3_128\n---\n`syntax: hash = mmh3.murmurhash3_128(string[, seed])`\n\nGenerate 128 bits hash from given string, with an optional seed(default 0).\nThe returned result is represented by a 16 bytes long Lua string.\nThis version is optimized for x64 platform.\n\nmurmurhash3_128_x86\n---\n`syntax: hash = mmh3.murmurhash3_128_x86(string[, seed])`\n\nGenerate 128 bits hash from given string, with an optional seed(default 0).\nThe returned result is represented by a 16 bytes long Lua string.\nThis version is optimized for x86 platform and its output is different from `murmurhash3_128`.\n\n## Installation\n\n`cmake . \u0026\u0026 cmake --build .` to build the `libmurmurhash3` library, then copy it to your `lua_package_cpath`.\nAlso copy the `murmurhash3.lua` to your project, so that you could call those methods.\n\nIf you are using `luarocks`, you could install it via `sudo luarocks install lua-resty-murmurhash3`\nand require it in your project with `local mmh3 = require \"murmurhash3\"`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacewander%2Flua-resty-murmurhash3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacewander%2Flua-resty-murmurhash3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacewander%2Flua-resty-murmurhash3/lists"}