- Notifications
You must be signed in to change notification settings - Fork94
Bijective conversion between natural numbers (IDs) and short strings
License
NotificationsYou must be signed in to change notification settings
delight-im/ShortURL
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Bijective conversion between natural numbers (IDs) and short strings
Useful for URL shorteners and short IDs in your permalinks
ShortURL.encode()
takes an ID and turns it into a short stringShortURL.decode()
takes a short string and turns it into an ID
- very short strings (much shorter than hex)
- uses large alphabet of 51 characters
- URL-safe (in contrast to Base64)
- doesn't use any characters that need to be encoded for use in URLs
- protection against offensive words (in contrast to Base64 and hex)
- vowels are not used
- unambiguous (in contrast to Base64 and hex)
- look-alike characters are not used
3141592
<=>vJST
123456789
<=>pgK8p
All numbers from 1 to 2,147,483,647 inclusively can be safely encoded and decoded again in all implementations.
All contributions are welcome! If you wish to contribute, please create an issue first so that your feature, problem or question can be discussed.
This project is licensed under the terms of theMIT License.