skillfed

hashids

Implements the hashids algorithm in python. For more information, visit http://hashids.org/

hashids v1.3.1 2.6M downloads/30d#2,965 on PyPI
Permissive license Abandoned released

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 hashids

uv

uv add hashids

poetry

poetry add hashids

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8

Tags

encode integers to short hashesobfuscate database idsyoutube-like hash generationreversible integer encodingurl-safe id obfuscationhashids algorithm pythonnon-sequential hash encoding
id-obfuscationurl-encoding

More Utilities packages