$C$ = M $\oplus$ K1 $\oplus$ K2 $\oplus$ K3

One can decrypt $C$ in any sequence, like:

$C$ $\oplus$ K1 = M $\oplus$ K2 $\oplus$ K3

$C$ $\oplus$ K1 $\oplus$ K3 = M $\oplus$ K2

$C$ $\oplus$ K1 $\oplus$ K3 $\oplus$ K2 = M


$C$ $\oplus$ K2 = M $\oplus$ K1 $\oplus$ K3

$C$ $\oplus$ K1 $\oplus$ K3 = M $\oplus$ K2

$C$ $\oplus$ K1 $\oplus$ K3 $\oplus$ K2 = M

Notice that on the 1st decryption we started with XORing with K1, and on the 2nd we started with K2.

If we were to use AES, as far as I understand, you would have to decrypt in the same order as you have encrypted. Given:

$C$ = $AES(AES(AES(M,K1),K2),K3)$

If you were to decrypt in the following manner for instance you would not get M:

$AES^{-1}((AES^{-1}(AES^{-1}(C,K2), K1)),K3) \neq M$

On the other hand:

$AES^{-1}((AES^{-1}(AES^{-1}(C,K3), K2)),K1) = M$.

My question:

1) What is the name of the property which allows a cypher to be decrypted in any order after encrytpion (like in XOR).

2) Are there common cypher (not including XOR) which contain this property (assuming K1,K2,K3 are known to different actors and cannot be shared).

  • $\begingroup$ You want commutative encryption. $\endgroup$ – SEJPM Sep 21 '17 at 17:59

XOR is a linear operation which is inverse of itself too.

k1 $\oplus$ k1 = 0

It is also commutative.

(k1 $\oplus$ k2) $\oplus$ k3 = k1 $\oplus$ (k2 $\oplus$ k3)

Thats why you can decrypt the way you have shown in question. Where as AES is not a linear operation and it is not inverse of itself. Applying AES encryption twice with same key will not produce the orignal Text.

AES(K1, AES(K1, M)) $\neq$ M

AES is also not Commutative

AES(K1, AES(K2, M)) $\neq$ AES(K2, AES(K1, M))

1) Simple XOR operation is not a cipher until its One Time PAD. Encrypting multiple texts with same keys using XOR will be a total break. Its use of the XOR operation which allows to decrypt the way you have shown because XOR is commutative, associative, and its own inverse.

2) The Block Encryption algorithms will not exhibit properties like commutative, associative, and its own inverse. However Cipher can be used to generate a random key stream (Like Stream Cipher) in CTR mode which is then XOR with the plaintext to make ciphertext. So in the End its commutative and associative operation.


Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.