Search code examples
cryptographyconcatenationbitwise-xor

How to understand string concatenation (||) and bit-wise exclusive-or ( (+) ) in cryptography


Here's a question to prove that F is a block cipher.

Algorithm F_{K1||K2} (x1||x2)
return AES^(-1) (K1,x1(+)x2) || AES(K2,X2(+)K1)

I want to prove the inverse of F, but I don't understand these two operation || and (+), so I don't know how to simplify it.

Algorithm F^{-1}_{K1||K2} (AES^(-1) (K1,x1(+)x2)|| AES(K2,X2(+)K1))
return (x1||x2)

AES^(-1) (K1,x1(+)x2) as x1
AES(K2,X2(+)K1) as x2

Could you help me with it?


Solution

  • Operations in cryptography are usually defined over bits and not bytes, but they mean the same thing over bytes or collection of bytes.

    Concatenation examples:

    1 || 1 = 11
    11100 || 10101000 = 1110010101000
    

    XOR returns 0 if both operands are equal. Otherwise 1:

      100100101
    + 001100110
    -----------
      101000011