Simple number-to-number (or number-to-hex) encryption algorithm that minimizes # of characters

Posted by Clay Nichols on Stack Overflow See other posts from Stack Overflow or by Clay Nichols
Published on 2010-05-23T23:49:52Z Indexed on 2010/05/24 0:01 UTC
Read the original article Hit count: 373

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?

© Stack Overflow or respective owner

Related posts about Windows

Related posts about algorithm