Overview
Hashids2 is a lightweight Dart package that generates short, unique, and URL-safe IDs from numbers, similar to YouTube's ID format. It's designed to obfuscate database IDs, preventing users from guessing or manipulating sequential identifiers. Ideal for public-facing applications where security through obscurity is beneficial. The library supports multiple platforms including Android, iOS, Web, macOS, Windows, and Linux, making it versatile for cross-platform apps. It uses customizable salt and length settings to ensure uniqueness and control over output format.
Use cases
- Obfuscating database IDs in URLs
- Generating short unique identifiers
- Securing API endpoints from ID enumeration
- Creating user-friendly shareable links
- Preventing sequential ID exposure in public APIs
Key features
- Generates URL-safe strings from numbers
- Customizable salt and minimum length
- Cross-platform compatibility
- Simple integration with Flutter apps
- Supports both encoding and decoding
Suitable for
- Web and mobile apps needing secure ID generation
- Developers wanting to hide database structure
- Applications with public-facing identifiers
- Projects requiring simple obfuscation without complex cryptography
Considerations
- Not suitable for high-security cryptographic needs
- Requires careful salt management for uniqueness
- Does not provide encryption or authentication
- Output length depends on input size and configuration
- Limited to ID obfuscation, not full data protection