Professional Documents
Culture Documents
What Is Encryption ?
What Is Encryption ?
What Is Encryption ?
Cryptography, then, not only protects data from theft or alteration, but can also be used
for user authentication. There are, in general, three types of cryptographic schemes
typically used to accomplish these goals: secret key (or symmetric) cryptography, public-
key (or asymmetric) cryptography, and hash functions, each of which is described below.
In all cases, the initial unencrypted data is referred to as plaintext. It is encrypted into
ciphertext, which will in turn (usually) be decrypted into usable plaintext.
In many of the descriptions below, two communicating parties will be referred to as Alice
and Bob; this is the common nomenclature in the crypto field and literature to make it
easier to identify the communicating parties. If there is a third or fourth party to the
communication, they will be referred to as Carol and Dave. Mallory is a malicious party,
Eve is an eavesdropper, and Trent is a trusted third party.
What is Encryption ?
Encryption is ( sometimes called enciphering ) transforms original information, called
plaintext or cleartext, into transformed information, called ciphertext, codetext, or simply
cipher. The transformed information, in its encrypted form, is called the cryptogram.
Encryption is reversible. After transmission, when the information has reached its
destination, the inverse operation ( decryption, sometimes called deciphering ) transforms
the ciphertext back to the original plaintext.
The technique or rules selected for encryption known as the encryption algorithm
determines how simple or how complex the process of transformation will be.
The study of encryption and decryption is called cryptography, from the Greek kryptos
meaning hidden and graphia, meaning writing.
1
Description and Examples :
2
Here, is another Example of an encryption and decryption:
alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...
ABCDEFGHIJKLMNOPQRS
3
A B C D E F G H I J K L M N O P Q R S T
U... 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17
18 19 20...
A simple encryption algorithm might consist of adding the plaintext to the encryption-
key, using MODULO-26 ARITHMETIC. That is, if the sum of any two numbers
obtained by ordinary addition is 26 or greater, then you subtract 26 from the ordinary sum
to obtain the modulo-26 sum. Thus, 05+12=17 by both ordinary and modulo-26
arithmetic, but 15+12=27 by ordinary arithmetic but 15+12=01 by modulo-26 arithmetic.
Hence, the ciphertext for THEQUICKBROWNFOX is
19080619241308170901240725180212, as follows:
19 07 04 16 20 08 02 10 01 17 14 22 13 05 14 23
(+) 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
(modulo-26)
_____________________________________________________
19 08 06 19 24 13 08 17 09 00 24 07 25 18 02 12
The ciphertext may then be decrypted by the receiver, using the decryption-key
AZYXWVUTSRQPONMLKJIHGFEDCBAZYX... and modulo-26 arithmetic, as
follows:
19 08 06 19 24 13 08 17 09 00 24 07 25 18 02 12
(+) 00 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11
(modulo-26)
_____________________________________________________
19 07 04 16 20 08 02 10 01 17 14 22 13 05 14 23
4
Here is an example of a very simple transposition cipher, the letters of the original text
( the plaintext ) are scrambled. With this type of cipher, the original letters of the plaintext
are preserved; only their position change.
5
More Example of Transposition Cipher :
This example is also very simple.
7 4 5 1 2 8 3 6 Plaintext
p l e a s e t r pleasetransferonemilliondollarsto
a n s f e r o n myswissbankaccountsixtwotwo
e m i l l i o n Ciphertext
d o l l a r s t AFLLSKSOSELAWAIATOOSSCTCLNMOMANT
o m y s w i s s ESILYNTWRNNTSOWDPAEDOBUOERIRICXB
b a n k a cc o
u n t s i xt w
o t w o a bc d
6
More About Substitution : Although earlier substitution ciphers, Julius Caesars military
use of such a cipher was the first clearly documented case. Caesars cipher, shown in the
figure, is a simple form of encryption in which each letter of an original message is
replaced with the letter three places beyond it in the alphabet.
A slight generalization of the Caesar cipher allows the ciphertext alphabet to be shifted
by k letters, instead of always 3. In this case k becomes a key to the general method of
circularly shifted alphabets. The Caesar cipher may have fooled the Carthaginians, but it
has not fooled anyone since.
The next improvement is to have each of the symbols in the plaintext, say the 26 letters
for simplicity, map onto some other letter. For example,
Plaintext: a b c d e f g h i j k l m n o p q r s t u v w x y z
Ciphertext:Q W E R T Y U I O P A S D F G H J K L Z X C V B N M
This general system is called a monoalphabetic substitution, with the key being the 26-th
letter string corresponding to the full alphabet. For the key above, the plaintext attack
would be transformed into the ciphertext QZZQEA.
More complex ciphers do not use simple substitutions or transpositions. Instead, they use
a secret key to control a long sequence of complicated substitutions and transpositions.
The operation of the algorithm upon the original information and the key produces the
cipher alphabet that encrypts the information.
Modern cryptographic systems fall into two general categories ( identified
by the types of keys they use) : private key and public key systems.
7
2) Public Key Cryptography
3) One- Time Pad
4) The Data Encryption Standard (DES)
5) DES Chaining
6) The RSA Algorithm
7) Digital Signatures
8) Hash Functions
2) Public Key Cryptography : Public key (sometimes called asymmetric key or two key
) systems use two key: a public key and a private key. Within a group of users for
8
example, within a computer network- each user has both a public key and a private key.
A user must keep his private key a secret, but the public key is publicly known; public
keys may even be listed in directories of electronic mail addresses.
Public and private keys are mathematically related. If you encrypt a message with your
private key, the recipient of the message can decrypt it with your public key. Similarly,
anyone can send anyone else an encrypted message, simply by encrypting the message
with the recipients public key; the sender doesnt need to know the recipients private
key. When you receive an encrypted message, you, and only you, can decrypt it with your
private key.
3) One- time Pad : One approach, known as a one- time pad or a one- time cipher key,
can be proven mathematically to be foolproof. As its name indicates, the pad is used only
once, and the key must be destroyed after a single use.
With a one-time cipher, you create two copies of a pad containing a set of completely
random numbers. (These are numbers produced by a secure random number generator,
possibly one based on some physical source of randomness. Sometimes, one-time pads
are based on the process of nuclear radioactive decay.) The set contains at least as many
numbers as the number of characters in your message. The sender of the message gets
one copy of the pad; the recipient gets the other. On a computer system, one way to
encrypt or decrypt a one-time message is to use a mathematical function called an
exclusive OR, or XOR. When the sender XORs the message with the first copy of the
pad, the process creates the encrypted message. When the recipient XORs the encrypted
message with the second copy of the pad, the process recreates the original message, as
shown in the following figure.
9
4) The Data Encryption Standard : In January 1977, the U.S. government adopted a
product cipher developed by IBM as its official standard for unclassified information.
This cipher, DES ( Data Encryption Standard), was widely adopted by the industry for
use in security products. It is no longer secure in its original form (Wayner, 1995), but in
a modified form it is still useful. We will now explain how DES works.
DES uses a 56-bit key. In fact, the 56-bit key is divided into eight 7-bit blocks and an 8th
odd parity bit is added to each block (i.e., a "0" or "1" is added to the block so that there
are an odd number of 1 bits in each 8-bit block). By using the 8 parity bits for
rudimentary error detection, a DES key is actually 64 bits in length for computational
purposes (although it only has 56 bits worth of randomness, or entropy).
DES then acts on 64-bit blocks of the plaintext, invoking 16 rounds of permutations,
swaps, and substitutes, as shown in Figure 6. The standard includes tables describing all
of the selection, permutation, and expansion operations mentioned below; these aspects
of the algorithm are not secrets. The basic DES steps are:
2. The 64-bit permuted input is divided into two 32-bit blocks, called left and
right, respectively. The initial values of the left and right blocks are
denoted L0 and R0.
10
3. There are then 16 rounds of operation on the L and R blocks. During each
iteration (where n ranges from 1 to 16), the following formulae apply:
Ln = Rn-1
Rn = Ln-1 XOR f(Rn-1,Kn)
11
At any given step in the process, then, the new L block value is merely taken from the
prior R block value. The new R block is calculated by taking the bit-by-bit exclusive-OR
(XOR) of the prior L block with the results of applying the DES cipher function, f, to the
prior R block and Kn. (Kn is a 48-bit value derived from the 64-bit DES key. Each round
uses a different 48 bits according to the standard's Key Schedule algorithm.)
The cipher function, f, combines the 32-bit R block value and the 48-bit subkey in
the following way. First, the 32 bits in the R block are expanded to 48 bits by an
expansion function (E); the extra 16 bits are found by repeating the bits in 16
predefined positions. The 48-bit expanded R-block is then ORed with the 48-bit
subkey. The result is a 48-bit value that is then divided into eight 6-bit blocks.
These are fed as input into 8 selection (S) boxes, denoted S1,...,S8. Each 6-bit input
yields a 4-bit output using a table lookup based on the 64 possible inputs; this
results in a 32-bit output from the S-box. The 32 bits are then rearranged by a
permutation function (P), producing the results from the cipher function.
1. The results from the final DES round i.e., L 16 and R16 are
recombined into a 64-bit value and fed into an inverse initial permutation
(IP-1). At this step, the bits are rearranged into their original positions, so
that the 58th, 50th, and 42nd bits, for example, are moved back into the
1st, 2nd, and 3rd positions, respectively. The output from IP -1 is the 64-bit
ciphertext block.
Consider this example with the given 56-bit key and input:
Key: 110010101001001001001001110101101010101011
11011000011010
12
records, one per employee, in the format shown : 16 bytes for the name, 8 byte blocks
( numbered from 0 to 15) is encrypted by DES.
Here is a small example of RSA algorithm. For this example, we have chosen p = 3 and q
= 11, giving n = 33 and z = 20. A suitable value for d is d = 7, since 7 and 20 have no
common factors. With these choices, e can be found by solving the equation 7e = 1 ( mod
13
20 ), which yields e = 3. The ciphertext, C, for a plaintext message, P , is given by C = P3
( mod 33 ). The ciphertext is decrypted by the receiver according to the rule P = C7 (mod
33). The figure shows the encryption of the plaintext SUZANNE as an example.
PUBLIC KEY:
n = product of two prime numbers, p and q.
e is relatively prime to (p-1)*(q-1).
PRIVATE KEY:
d = (e-1) mod((p-1)(q-1)).
ENCRYPTION:
c = (te) mod n.
DECRYPTION:
t = (cd) mod n.
where n is the (public) product, e is the public (=encryption) key, d is the private
(=decryption) key, t is the plaintext, and c is the ciphertext.
The term x modulo n, or x mod n, denotes the (whole number) remainder of the
division of x by n. Modulo arithmetic, or so-called 'clock arithmetic', is the mathematical
14
method by which we determine, say, that five hours after ten o'clock, it is three o'clock.
That is, the ordinary clock is a modulo-12 device, and [(5+10) mod 12] equals 3.
Similarly, the second-hand and minute-hand on the clock are modulo-60 devides, and the
military clock is a modulo-24 device. Modulo arithmetic has the fantastic advantage that
integer arithemetic can be performed on huge integers with absolute accuracy, without
having intermediate calculations exceed a predetermined size, namely, the square of the
modulus. Modulo arithmetic is one of the pillars of modern cryptography.
The next task is to select e, which must be relatively prime (i.e., not share a common
factor larger than one) with ((p-1)*(q-1)) = 30*36 = 1080. For this simple example, one
may simply try out all the possible values of e less than sqrt(1081) (the so-called SIEVE
OF ERATOSTHENES). That is, one requires a value of e such that there is a whole-
number d such that d * e = 1081. For really big primes, there are more efficient ways to
obtain d,e. In the present example, e=23, d=47, and
d * e = 23 * 47 = 1081 = (1) mod 1080 = (1) mod ((p-1)*(q-1)).
That is, '1 mod 1080' denotes that the remainder of 1081 divided by 1080 is 1. Since d * e
= 1 can be written equivalently as d = (e-1), we can assert that:
d = (23-1) mod(30*36) = 47.
Let the plaintext message be the number t=13. Then we may encrypt the plaintext
message, t, according to the formula in Table 1 as:
c = (t23) mod n = (1323) mod 1147 = 520.
That is:
t1 = 13, and (t1) mod 1147 = 13.
t2 = 169, and (t2) mod 1147 = 169.
t3 = 2197, so that (t3) mod 1147 = 1050.
The calculation may be continued on a small calculator by noting that:
[t4 mod 1147] equals [t * [(t3) mod 1147] mod 1147]
[t5 mod 1147] equals [t * [(t4) mod 1147] mod 1147]
....
c = [1323 mod 1147] equals [t * [(t22) mod 1147] mod 1147]
c = (1323) mod 1147 = 520.
In this manner, the whole-numbers in the intermediate calculations never exceed 11472 in
size.
When the receiver obtains the ciphertext, c=520, it may be decrypted by the formula
15
t = (cd) mod n = (52047) mod 1147 = 13.
Note that not even the sender can decrypt the initial message, t, after it has been
encrypted into ciphertext, c.
8) Hash Functions : Hash functions, also called message digests and one-way
encryption, are algorithms that, in some sense, use no key (Figure 1C). Instead, a
fixed-length hash value is computed based upon the plaintext that makes it
impossible for either the contents or length of the plaintext to be recovered. Hash
algorithms are typically used to provide a digital fingerprint of a file's contents,
often used to ensure that the file has not been altered by an intruder or virus. Hash
functions are also commonly employed by many operating systems to encrypt
passwords. Hash functions, then, provide a measure of the integrity of a file.
16
o MD5 (RFC 1321): Also developed by Rivest after potential
weaknesses were reported in MD4; this scheme is similar to MD4
but is slower because more manipulation is made to the original
data. MD5 has been implemented in a large number of products
although several weaknesses in the algorithm were demonstrated
by German cryptographer Hans Dobbertin in 1996.
RIPEMD: A series of message digests that initially came from the RIPE
(RACE Integrity Primitives Evaluation) project. RIPEMD-160 was
designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel, and
optimized for 32-bit processors to replace the then-current 128-bit hash
functions. Other versions include RIPEMD-256, RIPEMD-320, and
RIPEMD-128.
Hash functions are sometimes misunderstood and some sources claim that no two files
can have the same hash value. This is, in fact, not correct. Consider a hash function that
provides a 128-bit hash value. There are, obviously, 2128 possible hash values. But there
are a lot more than 2128 possible files. Therefore, there have to be multiple files in fact,
there have to be an infinite number of files! that can have the same 128-bit hash value.
The difficulty is finding two files with the same hash! What is, indeed, very hard to do is
to try to create a file that has a given hash value so as to force a hash value collision
17
which is the reason that hash functions are used extensively for information security and
computer forensics applications. Alas, researchers in 2004 found that practical collision
attacks could be launched on MD5, SHA-1, and other hash algorithms. At this time, there
is no obvious successor to MD5 and SHA-1 that could be put into use quickly; there are
so many products using these hash functions that it could take many years to flush out all
use of 128- and 160-bit hashes. Readers interested in this problem should read the
following:
An excellent review of the situation with hash collisions can be found in RFC 4270 (by P.
Hoffman and B. Schneier, November 2005). And for additional information on hash
functions, see David Hopwood's MessageDigest Algorithms page.
Certain extensions of hash functions are used for a variety of information security and
digital forensics applications, such as:
CONCLUSION
This paper has briefly described how cryptography works. The reader must
beware, however, that there are a number of ways to attack every one of these
systems; cryptanalysis and attacks on cryptosystems, however, are well beyond
the scope of this paper. In the words of Sherlock Holmes (ok, Arthur Conan
18
Doyle, really), "What one man can invent, another can discover" ("The Adventure
of the Dancing Men").
The corollary to this is that consumers should run, not walk, away from any
product that uses a proprietary cryptography scheme, ostensibly because the
algorithm's secrecy is an advantage. This observation about not using "secret"
crypto schemes has been a fundamental hallmark of cryptography for well over
100 years; it was first stated explicitly by Dutch linguist Auguste Kerckhoffs von
Nieuwenhoff in his 1883 (yes, 1883) text titled La Cryptographie militaire, and
has therefore become known as "Kerckhoffs' Principle."
REFERENCES
19