{"id":18000172,"url":"https://github.com/smartvokat/optimus_hash","last_synced_at":"2025-03-26T07:32:04.708Z","repository":{"id":48580066,"uuid":"168039360","full_name":"smartvokat/optimus_hash","owner":"smartvokat","description":" ID hashing based on Knuth's multiplicative hashing algorithm","archived":false,"fork":false,"pushed_at":"2024-03-07T00:56:04.000Z","size":29,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-19T11:17:00.289Z","etag":null,"topics":["elixir","hashing","knuth-algorithm","obfuscation"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/smartvokat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-01-28T21:20:32.000Z","updated_at":"2021-08-18T07:41:14.000Z","dependencies_parsed_at":"2024-10-29T23:20:07.849Z","dependency_job_id":null,"html_url":"https://github.com/smartvokat/optimus_hash","commit_stats":{"total_commits":19,"total_committers":4,"mean_commits":4.75,"dds":"0.26315789473684215","last_synced_commit":"278a528eff420763250982de4a2d608105095b50"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartvokat%2Foptimus_hash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartvokat%2Foptimus_hash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartvokat%2Foptimus_hash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartvokat%2Foptimus_hash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartvokat","download_url":"https://codeload.github.com/smartvokat/optimus_hash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245611789,"owners_count":20643894,"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":["elixir","hashing","knuth-algorithm","obfuscation"],"created_at":"2024-10-29T23:10:00.748Z","updated_at":"2025-03-26T07:32:04.435Z","avatar_url":"https://github.com/smartvokat.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OptimusHash\n\n[![hex.pm](https://img.shields.io/hexpm/v/optimus_hash.svg?style=flat)](https://hex.pm/packages/optimus_hash)\n[![Continuous Integration](https://github.com/smartvokat/optimus_hash/actions/workflows/ci.yaml/badge.svg)](https://github.com/smartvokat/optimus_hash/actions/workflows/ci.yaml)\n\nA small library to obfuscated integers based on Knuth's multiplicative hashing algorithm. The algorithm is fast, reversible and has zero collisions.\n\nThis comes in very handy when you have e.g. integer-based primary keys in your database and you don't want to expose them to the outside world.\n\nThe library integrates well with [Absinthe.Relay](https://hexdocs.pm/optimus_hash/absinthe-relay.html#content).\n\n## Installation\n\nThe package can be installed by adding `optimus_hash` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:optimus_hash, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\n# Usage\n\n```elixir\n# This are just example values. Do not use them in production.\no = OptimusHash.new(prime: 1_580_030_173, mod_inverse: 59_260_789, random: 1_163_945_558)\n\nOptimusHash.encode(o, 15) # = 1103647397\nOptimusHash.decode(o, 1103647397) # = 15\n```\n\n[View the documentation for more information.](https://hexdocs.pm/optimus_hash)\n\n# Acknowledgements\n\nThis library is based on the [Go package](https://github.com/pjebs/optimus-go) which in turn is based on the [PHP library](https://github.com/jenssegers/optimus).\n\n# Alternatives\n\nThere are other methods to obfuscated IDs available:\n\n* [Hashids](https://hashids.org/) ([Elixir](https://github.com/alco/hashids-elixir))\n* [NanoID](https://github.com/ai/nanoid) ([Elixir](https://github.com/railsmechanic/nanoid))\n\nChoose one based on the properties (e.g. speed or output) you are looking for.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartvokat%2Foptimus_hash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartvokat%2Foptimus_hash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartvokat%2Foptimus_hash/lists"}