Cryptography Reference
In-Depth Information
Of course this is not really a trick at all. Note that 2 3
8 and 2 4
16. We can
in fact write any number between 8 and 16 as a power of 2, where the 'power'
will be a number between 3 and 4 (the details are easily found from any wider
introduction to exponentiation). The number 3.3 arises because 2 3 . 3
=
=
is a close
approximation to 10.
A.1.3 XOR
Now that we are familiar with binary numbers, it is worth mentioning a very
important way of combining two binary numbers, which is commonly used in
cryptography. This is the function exclusive or , better known as XOR, and usually
denoted by the symbol
.
When used to combine single binary digits, XOR takes two bits as input, and
results in a third bit. The result is calculated according to the following rules:
0
0
=
0
0
1
=
1
1
0
=
1
1
1
=
0
.
In other words, the result of the XOR of two bits is 1 if the two inputs are different,
and the result is 0 if the two inputs are the same.
When the XOR function is applied to binary numbers that are more than one
bit long, the XOR of the two binary numbers is the result of the XOR of each
individual bit. For example:
11010
10011
=
01001
=
1001
.
This follows because:
1
1
=
0
,
1
0
=
1
,
0
0
=
0
,
1
1
=
0
,
0
1
=
1
.
We can also XOR two binary numbers of different lengths by first padding the
smaller of the two numbers with leading zeros until it is the same length as
the larger number. The two numbers can then be XORed in the normal way. For
example, to compute 11010 101 we first pad out 101 to 00101 and then compute:
11010 00101 = 11111 .
A.1.4 Hex
The other base that we need is hexadecimal , better known as hex , which is base 16.
Themain reason that we need hex is that it provides a compact way of representing
binary numbers. This is particularly helpful for cryptographic keys, which are
often very long when represented in binary.
Search WWH ::




Custom Search