Simple number-to-number (or number-to-hex) encryption algorithm that minimizes # of characters
- by Clay Nichols
I need to encrypt a number and I and this encrypted value will be given to a customer ask a key so I want to minimize the number of digits and make them all printable.
So I'd like the result to be either all number or all Hex characters.
The current encryption method I'm using (for non numbers) converts the characters to hex (2 hex digits each). That doubles the number of characters. I also considered just treating the input as hex (so each pair of numbers is treated as a Hex pair, but then you have ambiguity between an input of 0123 and 123 (when decrypting that leading '0' is lost.
Any suggestions?