Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What type of encryption to use for 48-bit to 48-bit?

I've got a bunch of 48-bit (6 byte) values that I need to encrypt symmetrically. The two requirements are:

  1. The resulting encrypted value needs to also be 48-bits (6 bytes) long. They key itself can be (and would preferably be) much longer to guard again brute force attacks.

  2. The resulting encrypted value needs to be deterministic, i.e. value A using key B will always produce encrypted value C (we encrypt on the fly and show the encrypted data to the user so need to always show the same value)

All block ciphers I've found have used a minimum block size of 64 and appear to be fixed (you can't use an arbitrary block size). Should I be thinking about a stream cipher?

I'm doing this in Java.

Note: I've seen this question and associated answers but wasn't clear on whether the suggestions would satisfy my 2nd requirement.

like image 939
Marplesoft Avatar asked Sep 03 '25 14:09

Marplesoft


1 Answers

Consider format preserving encryption.

like image 105
Accipitridae Avatar answered Sep 05 '25 05:09

Accipitridae