What is the effect on Format Preserving Encryption security if I reorder text before FPE encryption?
Take as an example Canadian postal codes (letter-digit-letter digit-letter-digit):
- Parliment: K1A 0A6
- Santa Claus: H0H 0H0
- Easy to remember: A1B 2C3
Using the postal code as a base 36 number and applying FF1 (NIST 800-38g test vector AES128 key, no tweak) gives this ciphertext:
$$E_k(\mathtt{K1A0A6}_{36}) ==> U7F8BD_{36}$$
But the original format is not preserved (last character is not a number).
What is the difference effect on the security of encryption if I
- Group digits and characters toghether prior to encryption
- Reduce the base to 26 and 10 for letters and digits, respectively
- Apply FF1 on the two sets
- Re-order the ciphertext so format is preserved
Something like this:
\begin{gather} E_k(\mathtt{KAA}_{26}) ==> FDE \\ E_k(\mathtt{106}_{10}) ==> 143 \\ \end{gather}
Would end up with FF1 encrypted postal code: F1D 4E3