hashids2
2.0.0, released 6 years ago by leushchenko.com
Generate short, unique, decryptable YouTube-like hashes from numbers.
What it does
Ported from JavaScript, this library encodes unsigned integers into short unique strings and decodes them back. It allows specifying minimum hash lengths and avoids basic English curse words in generated hashes.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to hide sequential database IDs in URLs or public places
- You need to encrypt and decrypt IDs on the fly without storing them
Skip it when
- You need cryptographically secure hashing for passwords or sensitive security tokens
- You are working with negative integers
Strengths
- No external dependencies
- Supports multiple platforms including Android, iOS, web, and desktop
- Allows encoding multiple integers at once
Weaknesses
- Only supports integers greater than or equal to zero
- Not intended for cryptographic security
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
final hashids = HashIds();
final fromNumber = hashids.encode(42);
final number = hashids.decode(fromNumber);Alternatives
Packages that do the same job and could replace hashids2.
- sqids
Generate short YouTube-looking IDs from numbers and decode them back.
62Compare - acronym
A simple package to generate acronyms from strings with support for stop words and syllables.
45Compare - youtube_parser
Extracts YouTube video IDs from all kinds of valid YouTube URLs.
48Compare - phone_hint_android
Flutter plugin to retrieve a SIM‑based phone number hint on Android.
40Compare