hashids
Implements the hashids algorithm in python. For more information, visit http://hashids.org/
What it is and what it does
Hashids is a Python port of the JavaScript hashids library that converts integers into short, unique, non-sequential hashes suitable for embedding in URLs and user-facing contexts. It encodes one or many numbers into a hash string and decodes them back to the original integers, making it useful for hiding database IDs from end users while maintaining reversibility. The library supports customization through salt strings (for uniqueness), minimum hash length (for padding), and custom alphabets, and it deliberately avoids generating common English curse words.
The package has no external runtime dependencies and installs with low friction. It is tested against Python 2.7 and 3.5–3.8, though the project is now abandoned and has not been updated since its latest release. For most use cases involving ID obfuscation in web applications, it remains functional and stable, but you should be aware that no new features or compatibility updates will be released.
Use it for:
- Hide sequential database IDs in REST API URLs by encoding them as short hashes that decode back to the original ID.
- Generate obfuscated short codes for sharing links or resources without exposing the underlying numeric ID.
- Encode multiple related IDs into a single hash for compact URL parameters or API responses.
- Customize hash appearance with a salt to prevent third parties from easily predicting or decoding your ID scheme.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates short, unique, non-sequential hashes from integers, reversibly encoding and decoding them to obfuscate database IDs in URLs and user-facing contexts.
Yes, if you need reversible integer-to-hash encoding for ID obfuscation in web URLs or APIs and are comfortable with an abandoned but stable codebase. The package has no dependencies, installs easily, and works reliably on current Python versions. Install only if you do not expect future maintenance or updates; for new projects requiring active support or enhanced security properties, consider whether a maintained alternative better fits your risk tolerance.
Install
hashids on PyPI
pip
pip install hashidsuv
uv add hashidspoetry
poetry add hashidsInstalling hashids
Before you install
Installation is straightforward with no runtime dependencies. However, the package is abandoned—last release was 2020-07-26. It remains compatible with current Python versions but will not receive updates for new issues or language changes.
License in practice
Licensed under MIT (permissive), allowing use in open source and commercial projects without restriction. No notable licensing constraints.
Quickstart
pip install hashids
from hashids import Hashids
hashids = Hashids()
hashid = hashids.encode(123) # Returns 'Mj3'
ints = hashids.decode('Mj3') # Returns (123,)
Verify before relying
- Whether the package's obfuscation properties remain adequate for current security expectations or threat models.
- Whether abandonment affects compatibility with Python versions released after 3.8.
- How long the package has been without updates and whether that impacts production use.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=2.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,210 days since the last release |
| First released | |
| Downloads | 2,623,201/month — #2,965 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hashids-1.3.1-py2.py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
django-hashidsProvides a Django model field that proxies…
permissive · top 15,000 on PyPI
sqidsSqids encodes numbers into short, unique,…
permissive · top 15,000 on PyPI
django-sqidsAdds a Django model field that encodes primary…
permissive · top 15,000 on PyPI
shortuuidGenerates concise, URL-safe unique identifiers…
permissive · top 1,000 on PyPI
pyarmorPyarmor obfuscates Python scripts to protect…
unclear · top 15,000 on PyPI
nanoidGenerates cryptographically secure,…
permissive · top 5,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
py-multihashEncodes and decodes multihash digests,…
permissive · top 15,000 on PyPI
blurhashEncodes images into compact blurhash text…
permissive · top 15,000 on PyPI
pyarmor.cli.core.alpinePyarmor CLI Core Alpine provides pre-built…
unclear · top 15,000 on PyPI