Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Elixir
  3. hashids

hashids

MITElixir

An Elixir library for obfuscating numerical IDs into short, unique, reversible strings.

GitHubGitHub
282 stars16 forks0 contributors

What is hashids?

Hashids is an Elixir library that obfuscates numerical identifiers by encoding them into short, unique, reversible strings. It solves the problem of exposing sequential database IDs in user-facing contexts like URLs or APIs, providing a simple way to create non-sequential, customizable identifiers. The library is a direct port of the popular Hashids JavaScript implementation, adapted for Elixir's functional programming environment.

Target Audience

Elixir developers building web applications, APIs, or services where hiding sequential database IDs improves user experience or perceived security.

Value Proposition

Developers choose Hashids for its simplicity, reversibility, and customization options—offering a lightweight alternative to cryptographic hashing when security isn't the primary concern, with easy integration into Elixir projects.

Overview

Stringify your ids

Use Cases

Best For

  • Obfuscating database IDs in URLs for Elixir web applications
  • Creating short, unique tokens for API responses without exposing sequential IDs
  • Generating referral codes or user-friendly identifiers from numerical data
  • Encoding multiple integers into a single string for compact representation
  • Customizing ID formats with specific alphabets or length requirements
  • Porting Hashids functionality from JavaScript to Elixir-based projects

Not Ideal For

  • Applications requiring cryptographically secure hashing for sensitive data like passwords or tokens
  • Systems where non-reversible, globally unique identifiers are needed without a central registry (e.g., UUIDs)
  • Projects that demand fixed-length output strings regardless of input integer size or count

Pros & Cons

Pros

Reversible Encoding

Converts lists of integers into short, unique strings that can be accurately decoded back, as shown with examples like encoding [1,2,3,4] to '4bSwImsd' and decoding to the original list.

Highly Customizable

Supports custom salts, minimum output lengths, and alphabets, allowing tailored encoding for different use cases, such as using a Cyrillic alphabet for specialized tokens in the MyAccessToken example.

Faithful Port

Direct implementation of the popular Hashids JavaScript library, ensuring proven functionality and ease of adoption for Elixir developers, with consistent behavior across ecosystems.

Flexible Alphabet Support

Enables custom character sets with a minimum of 16 characters, facilitating unique encoding schemes without being restricted to default alphanumeric strings.

Cons

No Cryptographic Security

Explicitly not designed for security, making it vulnerable to reverse engineering or attacks if used for protecting sensitive information, as admitted in the philosophy section.

Breaking Changes

Version 2.0 introduced migration requirements from 1.0, as noted in the changelog reference, which can disrupt existing implementations and require additional effort to update.

Integer-Only Limitation

Limited to encoding lists of integers, so preprocessing is needed for other data types like strings or floats, adding complexity for non-numeric use cases.

Frequently Asked Questions

Quick Stats

Stars282
Forks16
Contributors0
Open Issues1
Last commit2 years ago
CreatedSince 2014

Tags

#elixir#library#id-obfuscation#url-shortening#decoding#encoding#hashids#api-security

Built With

E
Elixir

Included in

Elixir13.1k
Auto-fetched 1 day ago

Related Projects

moneymoney

Elixir library for working with Money safer, easier, and fun... Is an interpretation of the Fowler's Money pattern in fun.prog.

Stars848
Forks144
Last commit23 days ago
decimaldecimal

Arbitrary precision decimal arithmetic

Stars478
Forks109
Last commit2 days ago
inflexinflex

An Inflector library for Elixir

Stars384
Forks81
Last commit2 years ago
uuiduuid

UUID generator and utilities for Elixir

Stars368
Forks83
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub