Sqids (pronounced "squids") is an open-source library that lets you generate short unique identifiers from numbers. These IDs are URL-safe, can encode several numbers, and do not contain common profanity words. Read more .
This is what they look like:
Quick encode & decode example:
Sqids *sqids = [[Sqids alloc] init];
NSString *id_ = [sqids encode:@[@1, @2, @3] error:nil]; // @"86Rf07"
NSArray<NSNumber *> *numbers = [sqids decode:id_]; // @[@1, @2, @3]
If IDs are too short, you can pad them to a certain length:
SqidsOptions *options = [[SqidsOptions alloc] init];
options.minLength = @10;
Sqids *sqids = [[Sqids alloc] initWithOptions:options];
NSString *id_ = [sqids encode:@[@1, @2, @3] error:nil]; // @"86Rf07xd4z"
NSArray<NSNumber *> *numbers = [sqids decode:id_]; // @[@1, @2, @3]
Create unique IDs by shuffling the alphabet:
SqidsOptions *options = [[SqidsOptions alloc] init];
options.alphabet = @"k3G7QAe51FCsPW92uEOyq4Bg6Sp8YzVTmnU0liwDdHXLajZrfxNhobJIRcMvKt";
Sqids *sqids = [[Sqids alloc] initWithOptions:options];
NSString *id_ = [sqids encode:@[@1, @2, @3] error:nil]; // @"XRKUdQ"
NSArray<NSNumber *> *numbers = [sqids decode:id_]; // @[@1, @2, @3]
Full documentation is at https://github.com/sqids/sqids-objective-c
If you're looking for the original Hashids Objective-C, you can find it here: https://github.com/DrGodCarl/hashids-objc
The main use of Sqids is purely visual. If you'd like to use IDs instead of numbers in your project, Sqids could be a good choice.