Sometimes, one may choose to convert a numeric value to an alpha-numeric sequence.
One way to do this is as follows:
- Compile a list of characters to select from, into an alphabet array ([1-9, A-z, a-z] is one suggestion, but any ASCII sequence will do.)
- Read a digit from the numeric
- Increment your counter to step through the alphabet array by that number of index positions.
- The alphabet character at that position becomes the first (or last, for FIFO) character in the conversion.
- Be sure and check your counter for exceeding the dimension of the alphabet.
- Repeat until every numeric digit is converted.
The result is exactly as many characters as the input.
Note: This is not a hash, and should not be used where a hash is the intended operation. It is reversible.