Professional Documents
Culture Documents
What Is Encryption - Last - Last
What Is Encryption - Last - Last
Cryptography is the science of writing in secret code and is an ancient art; the first
documented use of cryptography in writing dates back to circa 1900 B.C. when an
Egyptian scribe used non-standard hieroglyphs in an inscription. Some experts argue that
cryptography appeared spontaneously sometime after writing was invented, with
applications ranging from diplomatic missives to war-time battle plans. It is no surprise,
then, that new forms of cryptography came soon after the widespread development of
computer communications. In data and telecommunications, cryptography is necessary
when communicating over any untrusted medium, which includes just about any
network, particularly the Internet.
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.
1
Table of contents :
1) Executive summary 1
2) Table of contents 2
6) Secrecy or Confidentiality 5
19) Conclusion 19
20) References 20
2
Introduction
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.”
3
Description and Examples :
4
alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZABCD...
ABCDEFGHIJKLMNOPQRS
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 01 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 01 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
5
Example of Transposition Cipher :
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.
6
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
7
More About Substitution : Although earlier substitution ciphers, Julius Caesar’s
military use of such a cipher was the first clearly documented case. Caesar’s 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.
8
Besides this, there are varieties types of encryption systems, such as
1) Private Key Cryptography
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
9
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
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 recipient’s public key; the sender doesn’t need to know the recipient’s 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.
10
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.
11
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)
12
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:
13
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.
14
6) The RSA Algorithm : For RSA algorithm, we have to
Bob wants to send Alice an encrypted message M so he obtains her RSA public
key (n,e) which in this example is (143, 7). His plaintext message is just the
number 9 and is encrypted into ciphertext C as follows:
M mod n = 97 mod 143 = 48 = C
e
When Alice receives Bob’s message she decrypts it by using her RSA private key (d, n)
as follows:
Cd mod n = 48103 mod 143 = 9 = M
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
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.
15
Symbolic Numeric P3 MOD 33 C7 MOD 33 Symbolic
S 19 6859 28 13492928512 19 S
U 21 9261 21 1801088541 21 U
Z 26 17576 20 1280000000 26 Z
A 01 1 1 1 01 A
N 14 2744 5 78125 14 N
N 14 2744 5 78125 14 N
E 05 125 26 8031810176 05 E
Sender’s computation Receiver’s Computation
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
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
16
modulus. Modulo arithmetic is one of the pillars of modern cryptography.
After determining prime numbers p and q, then calculating n, e, and d, one
discards p,q. The receiver distributes numbers (n, e) publicly, whereas d is kept
secret and known only to the receiver. The receiver needs numbers (n, d) to decrypt
his messages.
The paradigm of asymmetric encryption may be illustrated by a simple example that
can be verified on a hand calculator. (Actually, the hand calculator is a bit tedious; it is
probably faster to write a program in QBasic, Visual Basic, or PERL, if you know these
languages.) In the example, let p=31 and q=37. These are not large prime numbers, but
they serve as a didactic example. Then n= 31*37 = 1147.
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
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.
17
the origin of the message and the identity of the sender and to resolve any authentication
issues between sender and receiver. A digital signature is distinct for each specific
transaction. It is un forgeable and can potentially be used as a valid signature in legal
contracts. Public key encryption systems such as the RSA can produce digital signatures
quite readily. When a message is encrypted at the sender’s end, the sender’s key digitally
signs the message. When a message is decrypted at the recipient’s end, the key validates
the digital signature. If any alteration in either signature or message occurs, the signature
won’t verify any more.
An algorithm that provides both encryption and a digital signature might work like this.
Suppose Joe is sending a message to Claudia :
Joe encrypts the message with his private key (to sign it ).
Joe now applies Claudia’s public key to the message ( to keep it a secret from
anyone but Claudia ).
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.
18
Secure Hash Algorithm (SHA): Algorithm for NIST's Secure Hash
Standard (SHS). SHA-1 produces a 160-bit hash value and was originally
published as FIPS 180-1 and RFC 3174. FIPS 180-2 describes five
algorithms in the SHS: SHA-1 plus SHA-224, SHA-256, SHA-384, and
SHA-512 which can produce hash values that are 224, 256, 384, or 512
bits in length, respectively. SHA-224, -256, -384, and -52 are also
described in RFC 4634.
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, 2 128 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 —
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:
19
Burr, W. (2006, Match/April). Cryptographic hash standards: Where do
we go from here? IEEE Security & Privacy, 4(2), 88-91.
Gutman, P., Naccache, D., & Palmer, C.C. (2005, May/June). When
hashes collide. IEEE Security & Privacy, 3(3), 68-71.
Klima, V. (March 2005) "Finding MD5 Collisions - a Toy For a
Notebook."
Thompson, E. (2005, February). MD5 collisions and the impact on
computer forensics. Digital Investigation, 2(1), 36-40.
Wang, X., Feng, D., Lai, X., & Yu, H. (August 2004). "Collisions for
Hash Functions MD4, MD5, HAVAL-128 and RIPEMD."
Wang, X., Yin, Y.L., & Yu, H. (February 2005). "Collision Search
Attacks on SHA1."
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
Doyle, really), "What one man can invent, another can discover" ("The Adventure
of the Dancing Men").
20
only true test of good cryptography; any cryptographic scheme that stays in use
year after year is most likely a good one. The strength of cryptography lies in the
choice (and management) of the keys; longer keys will resist attack better than
shorter keys.
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
21