Decimal-based length-preserving cryptosystem

6 views
Skip to first unread message

apacs70

unread,
Nov 16, 2009, 10:30:35 AM11/16/09
to Encryption and Cryptography Mailing List
Hi,

I'm looking for suggestions to address following problem.

I want to encrypt sequence of digits and have as the ciphertext a
string of digits of the same length.
[Goes without saying that I

For example, if the input is an 8-digit string, then the ciphertext
should be an 8-digit string (leading zeroes permitted).

If I use AES, everything is handled internally in hex representation -
so frequently the ciphertext is much longer than the plaintext.

Consider following:
Max 8 digit number is: 99999999
In hex this is: 0x5f5e0ff

This could be treated as 4 bytes: <0x05><0xf5><0xe0><0xff>

If I use AES OFB, I will get 4 byte output.

Highest 4-byte output is <0xFF><0xFF><0xFF><0xFF>

Converting this back to an integer gives: 4294967295
I.e. a 10-digit number.

AES OFB is great for preserving length when input is hex.
However, not so good if I want to restrict plaintext & ciphertext to
digits only.

I'd rather not reinvent something to solve my problem - so any help
would be greatly received.
The solution should use industry-standard encryption algorithm (such
as AES).
Also, no restriction on bytes used (or length of) key and IV.

Kind regards,
David.

Reply all
Reply to author
Forward
0 new messages