Cryptography Reference
In-Depth Information
to be 32-bit processors , which means that the internal counters are composed of
32 switches each and are capable of counting up to 2 32 , or about 4.3 billion.
The binary numbering system works, at a logical level at least, just like the
decimal system. With decimal numbers, the fi rst nine digits are represented (for
instance) by the Arabic numerals 1, 2, 3, 4, 5, 6, 7, 8, and 9. After 9, a tens-place is
introduced, and 90 more unique numerals can be represented. After this, a hundreds-
place is introduced, and 900 more unique numerals can be represented, and so on.
Algebraically, the numeral 97,236 is 9 * 10 4
6 * 10 0 .
Binary numbers are usually represented with just two digits — 0 and 1 — cor-
responding to the off and on states of the internal hardware. It takes quite a few
more digits to represent a number in binary than in decimal, but any number that
can be expressed in one can be converted to the other. The binary number 11011010
is equal to 1 * 2 7
7 * 10 3
2 * 10 2
3 * 10 1
218.
It's customary to delimit binary numbers at the byte level, where one byte
consists of eight bits. There's no technical reason why this has to be eight bits
(although hardware design is slightly easier when the number of bits is a power
of 2). In the early days of computing, when communications providers charged
by the bit (!), early airline reservation systems adopted a fi ve-bit byte to save on
communication costs.
1 * 2 6
0 * 2 5
1 * 2 4
1 * 2 3
0 * 2 2
1 * 2 1
0 * 2 0
Understanding Binary Logical Operations
Binary numbers can be added, subtracted, multiplied and divided just like
decimal numbers. Every computing device in existence has a dedicated circuit
called an Arithmetic Logical Unit ( ALU ) whose purpose is to take as input two
or more numbers in binary form and output the result of a mathematical opera-
tion on those numbers. This is done using more primitive operations on binary
numbers — AND, OR, NOT, and XOR.
The AND Operation
The AND operation operates at a bit-level. If both bits are 1, AND returns 1. If
either bit is 0, AND returns 0. In other words, only if x is on AND y is on are
x AND y on. C exposes the AND operation via the & operator, and it works
on whole bytes. The result of C's & operator is the AND of each bit in the fi rst
operand with the corresponding bit in the second operand.
 
Search WWH ::




Custom Search