This is a small class library, used to display base 10 integers as an easy to read base31 number. This was library was created as part of a bigger project, where a human-readable uid was required.
Requirements for the encoder:
-
The encoded string should be easy for a human to read and memorise, if required (ie. not too long and alpha-numeric).
-
The encoded should not randomly generate a string that would be considered profanity (hence the exclusion of all vowel characters from the alpha-numeric range).
Sample usage:
#Convert base10 integer to base31 guid string: base10 = 12345 obj = Base31encoder.new(base_length=5) base31 = obj.int_to_base31($base10num) # base31 = “00DV7”