Proquint — Int to a readable string and back again

wick

Member
3rd Party Module Dev
Patreon Bronze
Joined
Jul 17, 2017
Location
oakland
I would be surprised if this ends up being useful to anybody else, but I implemented Proquints in cxs. They're useful for getting a pronounceable string out of an integer & be able to get the int back from that string.

I'm using it to make unique number IDs something I can show to the user & not have it be too computer-y.

I think I got the order of the information a little off from the official implementation (only having signed ints to work with also makes it a little different & a little funky at really high numbers), but it was close enough for my purposes.

Some example output:
Code:
QUINT of '0' : 'babab-babab'
INT of 'babab-babab' : '0

QUINT of '5' : 'babab-babaj'
INT of 'babab-babaj' : '5

QUINT of '303240362' : 'damig-difop'
INT of 'damig-difop' : 303240362

QUINT of '2147483646' : 'luzuz-zuzuv'
INT of 'luzuz-zuzuv' : 2147483646

QUINT of '2147483647' : 'luzuz-zuzuz'
INT of 'luzuz-zuzuz' : 2147483647

QUINT of '2147483648' : 'mabab-babab'
INT of 'mabab-babab' : -2147483648
 

Attachments

Top Bottom