Add $1100+0110$ in binary

366 Views Asked by At

I'm studying encryption in class and we're doing "One-Time-Pad" encryption and I've come across this situation. I want to code $1100$, where my key is $0110$). In my book it says that the cipher is $1010$ - done through binary addition.

$$1100+0110=1010$$

but how does that make sense. In a $4$-bit system the numbers can only go to $2^4-1=15$ digits. So $1100+0110=10010$ ($12+6=18$). Am I missing something?

2

There are 2 best solutions below

3
On BEST ANSWER

The usual encryption for a one-time pad is not addition, but the XOR (exclusive or) operation where you

  1. line up the digits

  2. If they're both one or both zero, they make a zero.

  3. If one is zero and the other is one, they make a one

You can see that this is consistent with what your book has for the answer.

0
On

$$1100+0110=10010$$ is correct and as a result $$1100+0110=1010$$ is wrong.

Notice we are simply adding $$12+6=18$$ and not $$12+6= 10$$

Unless something else is going on instead of simple adding.