1
The Applications of Mathematics in Cryptography
W Nithin Gautham
Vo Tham Minh Tue
Tessa
Thai Tian Si
Aprial 18
th
2007.
2
Contents
Abstract
………………………………………………………………………………………………
3
Acknowledgements
……………………………………………………………………………………4
Introductio
n
……………………………………………………………………………………………5
Definitions of common terms
…………………………………………………………5
Introduction to cryptography
………………………………………………………….6
What are the uses of cryptography
?
...............................................................................6
Literature review
………………………………………………………………………………………7
S/MIME
……………………………………………………………………
.
….7
Book Cipher
……………………………………………………………………7
Vigenere Encryption
………………………………………………………….8
Block Cipher
…………………………………………………………………..8
Vernam cipher (one time pad)
…………………………………
………………9
RSA
…………………………………………………………………………...11
Discussion
……………………………………………………………………………………………..
20
Cracking encryptions…………………………………………………..20
The Enigma Cipher…………………………………………………….21
Hash Function…………………………………………………………..22
Applications
……………………………………………………………
……………………………….23
Conclusion
………………………………………………………………………………………………24
3
Abstract
Cryptography has its roots deep into history. The first know encryption system was founded by Hebrew
scholars somewhere between 600

500 B.C in Mesopotamia. It was at first that
the ancient Egyptians
pioneered cryptography with hieroglyphs carved on stone. However this was later discovered that there
was no actual encrypted message and that it was probably just for display
purposes. The
messages were
encrypted using simple
algorit
hms and the text that was some recipes (they might have been encrypted to
prevent theft of the recipes).That was the earliest use of encryption and also was the birth of
cryptography. After that the Greeks and Romans used their own unique system of ciphers
to encrypt
their
military messages. Ever since the birth of the 20
th
century, the use of cryptography had started to boom
.
Perhaps the greatest use of cryptography occurred during the World War 2. The German military made
use of an encryption machine call
ed the enigma machine. All messages sent by the German military were
encrypted by the Enigma machine. The encryption was so strong and complex that spying on the German
military’s actions became almost impossible. It took staggering 14 years, several milli
on man hours and
thousands of stolen photos and thousands of hours of spying before the code of the enigma machine was
finally broken. It is believed by some historians that if the enigma machines
code,
were
not
broken;
the
outcome of World War 2 might hav
e been totally
different
.
Cryptography might have probably led to this
world being totally different! As the dawn of the 21
st
century arrived, it brought along with it the
widespread use of the internet and computers. Soon enough trends such as online shop
ping and online
banking became widely used. All these would never be possible without the use of encryption. As
technology advances, so does the availability of computing power. Nowadays the average user with a
desktop computer could easily encrypt text
fo
r fun or to keep information secure, with
powerful
algorithms that would probably
take years to crack the encryption using the brute force method.
There are
unbreakable codes that by their mathematical
properties
cannot be defeated by brute force. For exam
ple,
every bit of a byte has a corresponding key bit. A brute force attack would eventually reveal the correct
decoding but have no way knowing the correct plain text. A small 100 byte one

time pad encoded string
subjected to a brute force attack would eve
ntually reveal every 100 byte string possible, including the
correct plain text, famous quotes, people's names, and undiscovered wisdom, but mostly nonsense. Of all
the answers given, there is no way of knowing which is the correct one.
4
1.
Introduction
Let us take a look at some of the definitions of cryptology jargon:
Definitions
1.1
Cryptology

The study of cryptanalysis or cryptography.
1
.2
Cryptography
–
Is the study of making messages more secretive
1
.3
Cryptanalysis

Is the study of finding we
aknesses in cryptographic algorithms and schemes so as to
be able to defeat the scheme
1.4
Algorithm

A step

by

step problem

solving procedure, especially an established, recursive
computational procedure for solving a problem in a finite number of steps
. Or
An algorithm generally takes some input, carries out a number of effective steps in a finite amount of
time, and produces some output
1
.5
Encryption

Changing of text or other data into a code that appears to be unreadable.
1
.6
Decryption

Proces
s of converting encrypted data back into its original form, so
that
it can be
understood
1.7
Cipher
–
An algorithm that performs encryption and decryption
1.8
Plaintext

Text that has not been encrypted. Also called
clear text
plaintext is readable by a
nybody.
1.9
Cipher text

Series of symbols produced by a cipher to convey a message; intended to be unreadable
by unauthorized persons
who do not posses the encryption key
1.11
Encryption Key
–
A
pass phrase
which must be used to
encrypt the plain text
5
1
.12
Decryption Key
–
A pass phrase which must be used to decrypt the cipher text. Usually the
encryption key and decryption key is the same for the same plain text and cipher text.
2
.
What is Cryptography?
Data that can be read and understood without a
ny special measures is called plain text or clear
text. The method of disguising plaintext in such a way as to hide its message is called encryption.
Encrypting plaintext results into a non

readable format called cipher text. You use encryption to ensure
t
hat the information is hidden from anyone for whom it is not intended, even those who can see the
encrypted data. The process of reverting cipher text to its original plaintext is called decryption.
Cryptography is the science of using mathematics to encry
pt and decrypt data. Cryptography enables you
to store sensitive information or send it across insecure networks so that it cannot be read by anyone
except the intended recipient who has the key. While cryptography is the science of securing data,
cryptana
lysis is the science of analyzing and breaking secure communication. Cryptanalysis involves an
interesting combination of analytical reasoning, application of mathematical tools and pattern finding. A
cryptographic algorit
hm, or cipher, is
function
which i
s used in encrypting and decrypting something
. A
cryptographic algorithm works in combination with a key
t
o encrypt the plaintext. The same plaintext
encrypts to different cipher text with different keys. The securi
t
y of encrypted data is entirely dependen
t
on two things: the strength of the cryptographic algorithm and the secrecy of the key
or the length in
some cases
.
3.
Uses of Cryptography
Authentication purposes

Cryptology can be used to authenticate messages. For example, using
cryptography, it is p
ossible to determine if it was a certain person who actually wrote the message .For
example if it was written by Bob with the key
123456,
the cipher text decrypted with the key 123456
should produce a valid clear text.
Data Integrity
–
A form of cryptog
raphy can be applied to check whether a message has been
compromised with or not. This would be discussed later on
Privacy

Encryption provides privacy as a message that is encrypted cant be easily decrypted without the
correct key.
This allows someone to
protect his or her data from others. It also useful when sensitive data
is submitted over a network where there is potential for the information to be intercepted by a third party.
Encrypting the data would prevent someone form understanding it.
We shall
now discuss the different types of ciphers.
6
4
.1
S/MIME
S/MIME (Secure / Multipurpose Internet Mail Extensions) is a standard for public key encryption
and signing of e

mail in MIME. S/MIME provides the following cryptographic security services for
electr
onic messaging applications: authentication, message integrity and non

repudiation of origin (using
digital signatures) and privacy and data security (using encryption). S/MIME specifies the
application/pkcs7

mime (smime

type "enveloped

data") type for dat
a enveloping (encrypting): the whole
(prepared) MIME entity to be enveloped is encrypted and packed into an object which subsequently is
inserted into an appl
ication/pkcs7

mime MIME entity.
S/MIME functionality is built into the vast
majority of modern e

m
ail software and interoperates between them.
4
.2
Book cipher
A book cipher is a cipher in which the key is the identity of a book or other piece of text. Both
parties must have the same book and the same edition. Traditionally
book ciphers replace
words
in the
plaintext of a message with
their
location from a book. If a desirable word doesn't appear in the book then
it can't be encoded. However, an alternative approach is to replace individual letters rather than words. In
this case the book cipher is pro
perly a homophonic substitution cipher. However, this cipher generally
generates a large cipher text. A dictionary can be used for
convenience
; however,
its
alphabetical order
would make it
transparent
to cryptanalysis.
4
.3
Vigenère
Encryption (polyalpha
betic cipher)
a.
Introduction
The Vigenère cipher consists of several Caesar ciphers in sequence with different shift values. To
encipher, a table of alphabets is constructed, called a tabula recta, Vigenère square, or Vigenère table. It
consists of the alpha
bet written out 26 times in different rows. Each alphabet shifted cyclically to the left
compared to the previous alphabet. They represent 26 possible Caesar ciphers. At different points in the
encryption process, the cipher uses a different alphabet from
one of the rows. The alphabet used at each
point depends on a repeating keyword. For example, suppose that the plaintext to be encrypted is
“ATTACKATDAWN”. With the keyword "LEMON", the key can be produced “LEMONLEMONLE”.
The n
th
letter of the plaintext is
enciphered using the alphabet in row n
th
of the key. The cipher text is
“LXFOPVEFRNHR”. Decryption requires the knowledge of keyword.
b.
Mathematical presentation of Vigenère cipher.
L
etters A
–
Z are assig
ned to be from 0
–
25 (modulo 26).
7
A
B
C
D
E
F
G
H
I
J
K
L
M
N
0
1
2
3
4
5
6
7
8
9
10
11
12
13
O
P
Q
R
S
T
U
V
W
X
Y
Z
14
15
16
17
18
19
20
21
22
23
24
25
Table
2.1
: the correspondent number (modulo 26) of the alphabetical characters.
Let
K
i
be the modulo of corresponding key character,
P
i
be the modu
lo of plaintext and
C
i
be the
modulo of cipher text.
Encryption:
26
mod
)
(
i
i
i
K
P
C
Decryption:
26
mod
)
(
i
i
K
C
Pi
Example:
A
T
T
A
C
K
A
T
D
A
W
N
0
19
19
0
2
10
0
19
3
0
22
13
L
E
M
O
N
L
E
M
O
N
L
E
11
4
12
14
13
11
4
12
14
13
11
4
L
X
F
O
P
V
E
F
R
N
H
R
11
23
5
14
15
21
4
5
17
13
33
17
Table
2.2
: Mathematics of
Vigenère cipher
.
Although at first Vigenère cipher was strong against frequency analysis, it was broken finally by
using Kasiski examination to deduce the keyword’s length and the
n apply frequency analysis to work out
the plain text. The
task
is easily accomplished by
modern cryptanalysts.
Note: Kasiski examination looks for repetition in the long cipher text. If two positions of a
repetition are found, the distance between them is
a divisor of
n
. Examination of factors of
n
eventually
reveals the key length and the key can be deduced.
8
4
.4
Block Cipher
Block cipher has
two paired algorithms, one for encryption, E, and another for decryption, E

1
.
Both algorithms accept two inputs:
an input block of size
n
bits
(each bit is either 0 or 1)
and a key of size
k
bits. The result is an
n

bit output block. For any one fixed key, decryption is the inverse function of
encryption
.
For any block M and key K.
M
M
E
E
K
K
))
(
(
1
For each ke
y K, E
K
is a permutation over the set of input blocks. Each key selects one permutation
from the possible set of 2
n
. The larger the
n
is, the larger the set is. The larger number of permutation is,
the more secure the cipher is.
The block size,
n
, is typic
ally 64 or 128 bits. One of several modes of
operation is generally used along with a padding scheme to allow plaintexts of arbitrary lengths to be
encrypted. Each mode has different characteristics in regard to error propagation, ease of random access
and
vulnerability to certain types of attack. Typical key sizes (
k
) include 40, 56, 64, 80, 128, 192 and 256
bits. As of 2006, 80 bits is normally taken as the minimum key length needed to prevent brute force
attacks.
4
.5
Vernam Cipher (One

Time Pad)
In his g
roundbreaking paper in 1949, American mathematician
Claude Elwood Shannon
dicussed
cryptography from the viewpoint of information theory
: how much information is needed for the
crytanalyst to completely decode the cipher text and hence solve the cipher
.
Th
e more information are
“concealed” from the plaint text and the less pattern the cipher text is, the more secure the cipher is
because every cryptanalysis is to deduce patterns from the cipher text. Theoratically, the one

time pad,
with true randomness and
without reused key,
is
the most secure cipher because it successufully “hides”
most information from the plaintext. A
ll theoretically unbreakable ciphers must have the same
requirements as the one

time pad
.
In general, the one

time pad (OTP) is an encrypt
ion algorithm where the plaintext is combined by an
operation with a random key. For a binary stream, the key or "pad" consists of
random numbers
0 and 1.
The plain text and the key are combined by an operation XOR to give the cipher text and vice versa.
A
n unbreakable version of polyalphabetic cipher is suggested in the following:
Let
K
i
be the modulo of corresponding key character,
P
i
be the modulo of plaintext and
C
i
be modulo
of the cipher text with the key’s characters (and its modulo) are randomly ch
osen.
Encryption:
26
mod
)
(
i
i
i
K
P
C
9
Decryption:
26
mod
)
(
i
i
K
C
Pi
A
T
T
A
C
K
A
T
D
A
W
N
0
19
19
0
2
10
0
19
3
0
22
13
X
Y
R
B
T
G
S
A
E
O
D
P
23
24
17
1
19
6
18
0
4
14
3
15
X
R
K
B
V
Q
S
A
H
O
Z
C
23
17
10
1
21
16
18
19
7
14
25
2
Plain te
xt: ATTACKATDAWN
Key text: XYRBTGSAEODP.
Cipher text: XRKBVQSAHOZC
The key pad can be concealed and transferred as a file or a pad of paper so that the key is
destroyed after use
.
The cipher is named after Gilbert Vernam, one of its first inventor.
As a st
rong cipher, one

time pad cipher has many applications. In practical, one

time pad still has
weakness because the key may be intercepted. The constant change of key causes much inconvinience
and difficulty in providing secure transfers. However, the true p
ractical weakness of one

time cipher is
also its theoretical strength: the randomness. To a large extent, the world is
deterministic
. Every objects
are governed by a set of Newtonian Laws and follow a unique path. Strictly speaking, computer
programming is
sequent
and cannot generate true
“randomness”
or perform true
“parallel”
computing.
However, given the
high
complexity
of the system, many algorithms have been discovered to generate
pseudorandom numbers. A dice in motion is an object under complex condit
ions and laws. The
complexity or chaos of the system ensures the final result not easily computed and hence gives some
degrees of randomness. Only quantum world permits true randomness and probability; however such
devices are highly expensive and impracti
cal. The length of the key is also problematic. Lengthy plaintext
requires lengthy key, making management difficult. However, even with these pratical weakness, the one

time pad cipher is theoretically significant because it is the strongest, most secure c
ipher attainable.
4.6
RSA
10
The RSA algorithm was invented in 1978 by Ron Rivest,
Adi Shamir, and Leonard Adleman fro
MIT. They also applied for a patent for a encryption method of this algorithm.
RSA
uses
a public and private key
(both are numbers)
.
Only t
he public key is known; the private key is
kept secret.
Here is how Bob makes a one

way function
:
1.
Bob picks two large primes
p
and
q
, and let
n=pq. He calculates the totient function
)
1
)(
1
(
)
(
q
p
n
. Computation of the product of large two numb
ers is relatively easier than
computation of the prime numbers.
2.
Bob c
hoose
s
randomly a positive interger
e:
e
is greater than 1
;
e
is less than
φ(n)
;
e
and
φ(n)
are
relatively prime (no common factor). It is noted that
e
must be an odd number since
φ(n)
is an
even number.
e
and
φ(n)
are
released as a public key component.
1 <
e
<
φ(n)
and gcd(
e
,
φ(n)
)=1.
3.
Find a number
d
such that
(de

1)
is
divi
sible by
φ(n)
.
This is the private key component.
dk
≡
1 (mod n)
In modulo arithmetic,
d
is called the
multiplicative inverse of
e
.
To compute
d
, we find the integer
of function
e
n
x
y
1
)
(
to be an integer
.
d
can be computed much faster using ex
tended
Euclid
e
an algorithm.
The extended Euclidean algorithm is an extension to the Euclidean
algorithm
to find
the integers
x
and
y
in Bézout's identity
:
ax + by = gcd(a, b)
By substituting x and y as
e
and
φ(n)
:
de + bφ(n) = gcd(e, φ(n))
de + bφ(n) =
1
de ≡1(mod φ(n))
4.
The encryption function
E
,
C= (T
e
) (mod
n
)
, where
C
is the ciphertext (a positive integer),
T
is the
plaintext (a positive integer)
that are coprime to
n
.
5.
The decryption function
E

1
,
T= (C
d
) (mod
n
)
, where
C
is the ciphertext (a positiv
e integer),
T
is
the plaintext (a positive integer).
6.
Mathematics has shown that the function of E

1
(E(T))=T.
)
(mod
n
T
C
ed
d
Since
x
n
ed
)
(
1
:
ed
T
x
n
T
)
(
1
x
n
ed
T
T
T
)
(
)
(
Since
T
and
n
are co
prime, b
y Euler
’s Theorem,
T
φ(n)
≡1 (mod n)
:
)
(mod
)
(
)
(
n
T
T
T
T
x
n
ed
)
(mod
n
T
C
d
This triad of integers forms the basis of the encryption and decryption keys used in PK
cryptosystems. To break this cipher N must be factored
into prime factors. A secure cipher requires larg
e
prime numbers. A prime number is an integer that is divisible only by 1 and itself. To factor N, an
11
algorithm is needed to detect large prime numbers. However, prime numbers are very special. Their
distribution is not even: larger primes (200 digits) are
sparse and hard to find.
An approximation of a chance of a large number
X
to be a prime number is:
)
ln(
1
N
. For larger
X
,
)
ln(
1
N
becomes smaller. The approximation of n
th
prime number is
)
ln(
n
n
p
n
. However,
a
pproximation is still
approximation
while cipher requires the exact prime.
Because of odd characteristics of prime number, the b
est publicly available factoring algorithms
still
take millions of years to
process
a 200 digit number.
The larger the prime nu
mber is, the more secure
the cipher is.
Here’s an example of how the RSA scheme works (look at its sheer complexity of the numbers
generated)
P = 61
←
first prime number (destroy this after computing E and D)
Q = 53
←
second prime number (destroy this after computing E and D)
PQ = 3233
←
modulus (give this to others)
E = 17
←
public exponent (give this to others)
D
= 2753
←
private exponent
(keep this secret!)
Your public key is (E,
PQ).
Your private key is D.
The encryption function is:
encrypt(T) = (T
E
) mod PQ
= (T
17
) mod 3233
The decryption function is:
decrypt(C) = (C
D
) mod PQ
= (C
2753
) mod 3233
To encrypt
the plaintext
value 123, we do the following
:
encrypt(123) = (123
17
) mod 3233
12
= 337587917446653715596592958817679803 mod 3233
= 855
To decrypt the ciphertext value 855,
we do the following
:
decrypt(855) = (855
2753
) mod 3233
= 123
One
way to comp
ute the value of 855
2753
mod 3233 is like this:
2753 = 101011000001 base 2, therefore
2753 = 1 + 2
6
+ 2
7
+ 2
9
+ 2
11
=
1 + 64 + 128 + 512 + 2048
Consider this table of powers of 855:
855
1
= 855
855
2
= 367 (mod 3233)
855
4
= 367
2
(mod 3233)
= 2136 (mod 3
233)
855
8
= 2136
2
(mod 3233)
= 733 (mod 3233)
855
16
= 733
2
(mod 3233)
= 611 (mod 3233)
855
32
= 611
2
(mod 3233)
= 1526 (mod 3233)
855
64
= 1526
2
(mod 3233)
= 916 (mod 3233)
855
128
= 916
2
(mod 3233)
= 1709 (mod 3233)
855
256
= 1709
2
(mod 3233)
= 1282 (mo
d 3233)
855
512
= 1282
2
(mod 3233)
= 1160 (mod 3233)
855
1024
= 1160
2
(mod 3233)
= 672 (mod 3233)
855
2048
= 672
2
(mod 3233)
= 2197 (mod 3233)
Given the above, we know this:
855
2753
(mod 3233)
= 855
(1 + 64 + 128 + 512 + 2048)
(mod 3233)
= 855
1
x
855
6
4
x
855
128
x
855
512
x
855
2048
(mod 3233)
= 855
x
916
x
1709
x
1160
x
2197 (mod 3233)
= 794
x
1709
x
1160
x
2197 (mod 3233)
= 2319
x
1160
x
2197 (mod 3233)
= 184
x
2197 (mod 3233)
13
= 123 (mod 3233)
= 123
A computer can, however, compute 855
2753
(mod 3
233) directly:
855
2753
mod 3233
=
50432888958416068734422899127394466631453878360035509315554967564501055628612082559978744245
42811005438349865428933638493024645144150785172091796654782635307099638035387326500896686074
771829745822950342950407903581845940
95637793858659893688380836028401325097686207669773966753
32505428260934757351379880632564826393344530925943855624292330175197719001692491691280915059
60191787601713497254392792156967017899021343071464689712796102771813783945869677289869342365
2403116932170892
6961764372652131566583315871245975980304250314400683788324610178483071758547
45472520696889259958925443667014322054695431740022855009238636942444855973333063051607385302
8632193029135037454719467577767135795496520291979050578153287155839207030315958593749366
3283
54860209083063550704455658896319318011934122017826923344101330116480696334024075046952588669
87658669006224024102088466507530263953870526631933584734810948761562271260373275973603752373
88364148088948438096157757045380081079469800667348777958837582899851
327930703533551275090439
94817897905489933812173294585354474132680569810872633482854638168850488243465889783933346625
44540066196452187666947955280230884124659482392751057704911332902568430650522925614273038983
208900705151105525061899417123177795157979429711
79547529630183784386291397787766129820738907
27967672023501139927158196427307640741898919048686074812454931579537437712441601438765069145
86819640227602776686953090395131496831909732450545234594477256587887692693353918692354818518
5424209230649964068221844901
1913571088542442852112077371223831105455431265307394075927890822
60604317113339575226603445164525976316184277459043201913452893299321613074405322274705728948
12143586831978415597276496357090901215131304157569209798518321041155969357848833665315951327
34467524
394087576977789084901269153228420809496307929724713044221942439065903081428939302915
84830873687450789770869218452967411463211556678655283381648067954559418910069509196589908545
67980723923708463025535456869192355462995715735879062274586195721721110788286575
638597094190
77632050978323957134641190250047020848560408217509491077165531176529747380317676582058767314
02889103288343185088447211644271939037404131556498699591373651621084511374022433518599576657
753969362812542539006855262454561419258809437402128886669744
10972184534221817198089911953707
54554203391196453936646179296816534265223463993674233097018353390462367769367038053426448217
35823842192515904381485247388968642443703186654199615377913969649003039587606549152449450436
0013593927713395210125192857209259788751
1601959629615690271164318946373426500236310045557180
03693586055264910000907245183786689564417164907278356281009708545241354696608448116133878065
48545151761673086051080657829365241087232636672280540038794108643482267500907782651210137281
95831653139698309088
731741747453598868429855980718519221597004650810606844559536480892249440
14
54276632967459230889848486843586547985051154284401646235269693179937784430217857019197098751
62965466513027800996658005217820813931723237901323249468260920081998103768484716787498919369
49979148247163450609371256541225019537951668976018550875993133677977939527822273233375295802
63122665358948205566515289466369032083287680432390611549350954590934066764022586708483376053
699867941026204709057156744705653111242862907354888492989983560999636092
14112849774586146960
40287029670701478179490248282907484160083680458666855076046192252094349804715745268818131850
85915019485276359650345815364165654931601306133040743445796510838030406224027889804282518909
4716292266898016684480963645198090510905796513075703
7924595807447975237126676101147387874214
41491548135917439279949695641565386688389171544630561180536972834347021920634899953191764016
11039249043917980339897549176539592360851180765318470647331801578207412764787592739087492955
71685366518591266637383123594589
126787095838000224515094244575648744840868775308453955217306
36693891702394037184780362774643171470855830491959895146776294392143100245613061114299370005
57751339717282549110056008940898419671319709118165542908761090083249978313382407869615784923
419862991680
08677495934077593066022078149438078549967989453993640636857226974223618584114250
48372451244655802708591797955910865230997565198382779529457569965742455786883835444236857223
681399021261363744082131478483203563615611346287019851423901842909741638620232051039
71218498
33552863086851842826346150274418735863950404228151239950599598365379222728584742207167783667
94513436380708657977421985359539316627998878972169596345534633649794922113017661316207477266
1131070123214037138822702217232330854726795330150799806225383545
8948024820043144726191596190
52603406906193093929072410284948700167172969517703467909979440975063764929635675558007116218
27727603182921790350290486090976266285396627024392536890256337101471683274045045830602286763
14215815990079164262770005461232291921929971
699076901690259464681041412142044724026616582756
80524166861473393322659591270064563044741608529167218700704514464979322666873214634674904118
58867608368403061906957869900965213906752050197440767765104388515194161931847991913492438815
282203846472926944608491
52999588185988551951490663073117772381322675169458825936387861072430
25659809149010327838482140113655678493410243151248286452917031410040012016364829985325166349
05605379458508942440385525245547779224010461489075274516342513992163738356814149047932037426
3373
0198782540569961916352019389698254478631309773749154478427634532593998741700138163198116
64537720894400285485000269685982644562183794116702151847721909339232185087775790959332676311
4131296193984959261389879016697108810276638623167694057295932538078643444100
5121380250817976
22723797210352196773268441946486164029610598990277105325704570163326134310764177000432371524
74626393990118997278453629493036369149008810605312316300090101508393318801166821516389310466
66595137827498923745560511004016477716822716267270783701
224246551264878454923504185216742638
31897333324346744490397800178468972640546214802412412583384350170488532060147568786231809409
00126324196909225202267988011340807301221626440413388739260052309607238615855496515800103474
611979213076722454380367188325370860
67133113258199227975522771848648475326124302804177943090
15
93899237093805365204646255147267884961527773274119265709116613580084145421487687310394441054
79639308530896880365608504772144592172500126500717068969428154627563704588389042191773981906
4873190801482873
9058159462227867277418610111027632479729041222119941173882045263357017590906
78628159281519982214576527968538925172187200900703891385628400073322585075904853480465645434
9837073287625935891427854318266587294608072389652291599021738887957736477387265746104008
2255
11241827200961681888284938946788104688473126554172620978905678458109651797530087306315464903
02112133528180847612299040957642785731636412488093094977073956758842296317115846456984202455
10902988239851795368412589144635279189730768383407369613140974522985
638668272691043357517677
12889452788136862396506665408989439495161912002160777898876864736481837825324846699168307281
22031079193564666840159148582699993374427677252275403853322196852298590851548110402296579163
382573855133148234595916332814458198436145963060
24993617530979255612380390146906651636737188
59582772525683119989984646027216462797640770570748164064507697798699551061800464719378082232
50148934078511378332510737538234034662695532926088138438957840998041704104177760846306286261
0614059615207066695243018438
5750317629395430263126737740693640470589608346260188591118436753
25298458880408497109229991956553970191119191918832730860376677533960772245563211350657219106
75875118681278634419757239219526333385653838824005719010256494923394451965959203992392217400
24723414
719097096456210829954774619322898118128605556588093851898811812905614274085809168765
71191122476328865871275538928438126611991937924624112632990739867854558756652453056197509891
45781147357712836075540017742686609650933051721027230666357394623341363804591423
775996522030
94185588800394967558297112583616218901403595423493042474905369399277611426179640710012764328
0428706083531594582305946326827861270203356980346143245697021484375
mod 3233
= 123
RSA implements much larger numbers. Such large numbers takes long tim
e to compute and makes
crytanalysis very difficult.
5.
Discussion
a. Block cipher and cryptanalysis.
Most block ciphers are constructed by repeatedly applying a simpler function. This approach is
known as iterated block cipher (see also product cipher
). Each iteration is termed a round, and the
repeated function is termed the round function; anywhere between 4 to 32 rounds are typical.
Arithmetic operations, logical operations (especially XOR), S

boxes and various permutat
ions are all
frequently used i
n block ciphers
.
In the past linear and differential
cryptanalysis
were discovered to tackle
block cipher.
Differential cryptanalysis is a general form of cryptanalysis applicable primarily to block ciphers,
but also to stream ciphers and cryptographic h
ash functions. In the broadest sense, it studies of how
16
differences in an input can affect the resultant difference at the output. For block cipher, it refers to a set
of techniques for tracing differences through the network of transformations to discover
where the cipher
exhibits non

random
behavior
, and exploiting such properties to recover the secret key.
The discovery of differential cryptanalysis is generally attributed to Eli Biham and Adi Shamir in
the late 1980s, who published a number of attacks a
gainst various block ciphers and hash functions,
including a theoretical weakness in the Data Encryption Standard (DES). However, DES was especially
susceptible to differential cryptanalysis because the technique had been known to IBM cipher designers
for
years. However, other contemporary ciphers proved to be vulnerable.
Differential cryptanalysis is usually a chosen plaintext attack, meaning that the attacker must be
able to obtain encrypted ciphertexts for some set of plaintexts of his choosing. The sch
eme can
successfully
crypt analyze
DES with an effort on the order 2
47
chosen plaintexts. These
are also known
plaintext or even a ciphertext

only attack.
The basic method uses pairs of plaintext related by a constant difference (difference can be
defined
in several ways), but the eXclusive OR (XOR) operation is usual. The attacker then computes the
differences of the corresponding ciphertexts to detect statistical patterns in their distribution. A pair of
differences is called a differential. Their statist
ical properties depend upon the nature of the S

boxes used
for encryption, so the attacker analyses differentials (ΔX,ΔY), where
:
))
(
(
)
(
X
X
S
X
S
y
(
Denotes
e
X
clusive
OR
)
.
If the cipher exhibits pattern in a particular frequent
,
the cipher can be distinguished from random.
More sophisticated variations
can quickly recover the key.
However, to succeed, the input difference
must be carefully selected.
For any particular cipher, the input difference must be carefully selected if th
e
attack is to be successful.
An analysis of the algorithm's internals is undertaken
to
look
a path of highly
probable differences through the various stages of encryption, termed a differential characteristic.
Since
differential cryptanalysis became publi
c knowledge, designers
have improved their ciphers to be resistant
to the algorithm. For example,
Advanced Encryption Standard
has
been proven secure against the attack.
Linear cryptanalysis is discovered by Japanese cryptographer Mitsuru Matsui, who was i
nspired by
differential cryptanalysis.
It is one of the most widely used
techniques
apart from differential
cryptanalysis
.
In addition to linear and differential cryptanalysis, there
are
a number
of attacks: truncated
differential cryptanalysis, partial di
fferential cryptanalysis, integral cryptanalysis
(
square and integral
attacks
)
, slide attacks, boomerang attacks, the XSL attack, impossible differential cryptanalysis and
algebraic attacks.
17
b
.
Hash function.
A hash function is a reproducible method of t
urning some kind of data into a number that may
serve as a digital "fingerprint" of the data. The algorithm (i.e., substitutes or transposes) behind the hash
function to create such fingerprints are called hash values. The result, or hash, can be used as a
n index.
A good hash function must satisfy:

The hash must be as random as possible.

One plaintext must generate only unique hash.

Two different plaintexts must not have their hash matched (collisions).
Cryptographic hash functions are used for various pu
rposes in information security applications.
For example, Alice poses to Bob a tough math problem and claims she has solved it. Bob wants to try it
himself, but also wants to make sure that Alice is not boasting. Therefore, Alice writes down her solution,
and hashes it. She also tells him the hash value without revealing the solution. This way, when Bob
comes up with his solution a few days later, Alice can prove that she had the solution earlier by revealing
the nonce to Bob. The above application is calle
d a commitment scheme. Another important application
of secure hashes is verification of message integrity. It is critical to determine whether or not any changes
have been made to a message (or a file), for example, by comparing message digests calculated
before,
and after, transmission (or any other event). A related application is password verification.
We have looked into what hash functions
are;
now let us look into their useful applications to the
modern world.
A hash function takes in a piece of da
ta and returns a hash (aka message or media digest)
which is simply an alpha
–
numeric string. A hash function would always give a different has for different
data. There are many commercial hash functions that are available for use. Often a small change i
n data
would still produce a huge change in to hash. The
MD5 (message
digest
5)
hash for the word “hello” is
5d41402abc4b2a76b9719d911017c592
where as the MD5 has for “helloo” is
328c2480a1e353ca895c78397c7d8cc9
. Notice how different the 2 hashes are.
Almost everyone has sent some data over the internet. By doing
so,
they have unknowingly made
use of hash functions.
When data is transmitted over the internet, it is prone to corruption and also loss.
Before sending the actual data over, the computer gene
rates a hash of the data and sends it to the other
computer. The computer then proceeds to receive the file. It then calculates the hash of the received data.
If both the hashes are not the same, it means that the data has been corrupted and the data has t
o be sent
over again. Almost all file sharing protocols and applications have such features built into them.
Let us imagine a situation where there are 5000 of 990000 character long numbers in a computer.
It would take ages to search up for a 990000 long n
umber if it was done the normal way , which is to look
up for that number amongst the other numbers. The reason it takes so long is due to the sheer size of the
18
data. Now a solution to this problem would be to get the hashes of all those
numbers assign a i
ndex to
then hash and then assign the data to the index. This way when a user searches, the search would be much
faster as the hash is usually of a small fixed size and searching using small texts is faster.
Hash functions have also been used to generate p
seudorandom n
umbers. These are numbers that
appear random but they really are not. It is just that the probability of 2 numbers being produced that are
not random is so small that it can be assumed to be random.
6.
Conclusion
Cryptography is an essentia
l part of our daily lives in the 21
st
century. It would be appropriate to
say t
hat our way of life would be drastically different. Cryptography is emerging as a very important tool
in the field of security today. With security becoming a very important fie
ld in the world of today,
cryptography is being catapulted into the limelight together with other methods of security. Indeed
cryptography is one of the first lines of defense against hackers and crackers in today’s world. Thus, it
will stay important for
a long time to come as it has for thousands of years since Caesar first invented the
Caesar cipher in an era before the birth of Christ. Ultimately, cryptography is here to stay as long as there
is still mathematics.
19
Appendix of number theory: Fermat’s Li
ttle Theorem, Euler Theorem, Euclidean Algorithm and its
extension, Chinese Remainder Theorem.
1. Fermat's little theorem
Fermat's little
states that if
p
is a
prime number
, then for any
integer
a
,
This means that if you start with a number,
initialised to 1, and repeatedly multiply, for a total of
p
multiplications, that number by
a
, and then subtract
a
from the resulting number, the final result is
divisible by
p
.
A variant of this theorem is stated in the following form: if
p
is a prime a
nd
a
is an integer
coprime
to
p
,
then
In other words, i
f
p
is a prime number and
a
is any integer that does not have
p
as a factor, then
a
raised
to the
p

1
power will leave a remainder of 1 when divided by
p
.
Examples of the theorem include:
4
3
− 4 = 60 is divisible by 3.
7
2
− 7 = 42 is divisible by 2.
6
3
−
6 = 210 is divisible by 3.
(−3)
7
− (−3) = −(2 184) is divisible by 7.
2
97
− 2 = 158 456 325 028 528 675 187 087 900 670 is divisible by 97.
Generalizations
A slight generalization of the theorem, which immediately follows from it, is as follows: if
p
i
s prime and
m
and
n
are
positive
integers with
, then
In this form, the theorem is used to justify
the
RSA
public
key
encryption method.
Fermat's little theorem is generalized by
Euler's theorem
: for any modulus
n
and any integer
a
coprime
to
n
, we have
where φ(
n
) denotes
Euler's φ function
counting the integers between 1 and
n
that are coprime to
n
. This is
indeed a generalization, because if
n
=
p
is a prime number, then φ(
p
) =
p
− 1.
20
2.
Euler's theorem
In
number theory
,
Euler's theorem
(also known as the
Fermat

Euler theorem
or
Euler's totient
theorem
) states that if
n
is a positive
integer
and
a
is
coprime
to
n
, then
where φ(
n
) is
Euler's totient function
and "mod" denotes the
congruence
relation.
The theorem is a gen
eralization of
Fermat's little theorem
, and is further generalized by
Carmichael's
theorem
.
The theore
m may be used to easily reduce large powers modulo
n
. For example, consider finding the last
decimal digit of 7
222
, i.e. 7
222
(mod 10). Note that 7 and 10 are coprime, and φ(10) = 4. So Euler's theorem
yields 7
4
≡ 1 (mod 10), and we get 7
222
≡ 7
4∙55 + 2
≡ (7
4
)
55
∙7
2
≡ 1
55
∙7
2
≡ 49 ≡ 9 (mod 10).
In general, when reducing a power of
a
modulo
n
(where
a
and
n
are coprime), one needs
to work modulo
φ(
n
) in the exponent of
a
:
if
x
≡
y
(mod φ(
n
)), then
a
x
≡
a
y
(mod
n
).
Euler's totient function
The first thousand values of
φ
(
n
)
In
number theory
, the
totient
φ(
n
)
of a
positive integer
n
is defined to be the number of positive integers
less
than
n
which are
coprime
to
n
. For example,
φ(8) = 4
since the four numbers 1, 3, 5 and 7 are
coprime to 8. The
function
φ
so d
efined is the
totient function
. The totient is usually called the
Euler
totient
or
Euler's totient
, after the
Swiss
mathematician
Leonhard Euler
, who studied it. The totient
function is also called
Euler's phi function
or simply the
phi function
, since the letter
Phi
(
φ
) is so
commonly used for it. The
cototient
of
n
is defined as
n

φ(
n
)
.
The totient function is important mainly because it gives the size of the multiplicative
group
of integers
modulo
n
. More precisely,
φ(
n
)
is the order of the group of
units
of the
ring
. This fact, together
with
Lagrange's theorem
, provides a proof for
Euler's theorem
.
Computing Euler's function
21
It follows from the definition that
φ(1) = 1
, and
φ(
n
) = (
p

1)
p
k

1
when
n
is the
k
th power of a
prime
number
p
. Moreover,
φ
is a
multiplicativ
e function
; if
m
and
n
are coprime then
φ(
mn
) = φ(
m
)φ(
n
)
.
(Sketch of proof: let
A
,
B
,
C
be the sets of residue classes modulo

and

coprime

to
m
,
n
,
mn
respectively;
then there is a
bijection
between
A
×
B
and
C
, via the
Chinese remainder theorem
.) The value of
φ(
n
)
can
thus be computed using the
fundamental theorem of arithmetic
: if
where the
p
j
are distinct
primes
, then
This last formula is a
Euler product
and is often written as
with the product ranging only over the distinct primes
p
r
.
Computin
g example
Some values of the function
φ(
n
)
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
0+
1
1
2
2
4
2
6
4
6
10+
4
10
4
12
6
8
8
16
6
18
20+
8
12
10
22
8
20
12
18
12
28
30+
8
30
16
20
16
24
12
36
18
24
40+
16
40
12
42
20
24
22
46
16
42
50+
20
32
24
52
18
40
24
36
28
58
60+
16
60
30
36
32
48
20
66
32
44
70+
24
70
24
72
36
40
36
60
24
78
80+
32
54
40
82
24
64
42
56
40
88
90+
24
72
44
60
46
72
32
96
42
60
Special cases
For
n
as a prime number,
φ(n)=(n

1).
For
n
as a product of two distinct prime numbers
p
and
q,
φ(n)=pq

1

(p

1)

(q

1)=pq

p

q+1=(p

1
)(q

1)=φ(p)φ(q)
22
3.
Euclidian Algorithm
In
number theory
, the
Euclidean algorithm
(also called
Euclid's algorithm
) is an
algorithm
to
determine the
greatest common divisor
(GCD) of two elements of any
Euclidean domain
(for ex
ample,
the
integers
). Its major significance is that it does not require
factoring
the two integers, and it is also
significant in t
hat it is one of the oldest algorithms known, dating back to the
ancient Greeks
.
History of the Euclidean algorithm
The Euclidean algorithm is one of the oldest algorithms known, since i
t appeared in
Euclid's
Elements
around
300 BC
. Euclid originally formulated the problem geometrically, as the problem of
finding a
common "measure" for two line lengths, and his algorithm proceeded by repeated subtraction of the
shorter from the longer segment. However, the algorithm was probably not discovered by
Euclid
and it
may have been known up to 200 years earlier. It was almost certainly known by
Eudoxus of Cnidus
(about 375 BC), and
Aristotle
(about 330 BC) hinted at it in his
Topics
, 158b, 29

35.
Description of the algorithm
Given two
natural numbers
a
and
b
: check if
b
is zero; if yes,
a
is the gcd. I
f not, repeat the process using
(respectively)
b
, and the remainder after dividing
a
by
b
(written a
mod
b below).
These algorithms can be used in any context where division with remai
nder is possible. This includes
rings of polynomials
over a
field
as well as the ring of
Gaussian integers
, and in general all
Euclidean
domains
. Applying the algorithm to the more general case other than natural number will
be discussed in
more detail later in the article.
Using
recursion
Using recursion, the algorithm can be expressed naturally:
function
gcd(a, b)
if
b = 0
return
a
else
return
gcd(b
, a
mod
b)
Using iteration
This is more efficient with compilers that don't optimize
tail recursion
:
function
gcd(a, b)
while
b ≠ 0
t := b
b := a
mod
b
a := t
return
a
23
The extended Euclidean algorithm
By keeping track of the quotients occurring during the algorithm, one can also determine integers
p
and
q
with
ap
+
bq
=
gcd(
a
,
b
). This is known a
s the extended Euclidean algorithm.
Original algorithm
The original algorithm as described by Euclid treated the problem geometrically, using repeated
subtraction rather than mod (remainder). This is significantly less efficient:
function
gcd(a, b)
w
hile
b ≠ 0
if
a > b
a := a

b
else
b := b

a
return
a
An example
As an example, consider computing the gcd of 1071 and 1029, which is 21. Recall that “mod” means “the
remainder after dividing.”
With the recurs
ive algorithm:
a
b
Explanations
gcd(
1071,
1029)
The initial arguments
=
gcd(
1029,
42)
The second argument is 1071 mod 1029
=
gcd(
42,
21)
The second argument is 1029 mod 42
=
gcd(
21,
0)
The second argument is 42 mod 21
=
21
Since
b=0
, we
retur
n a
With the iterative algorithm:
a
b
Explanation
1071
1029
Step 1: The initial inputs
1029
42
Step 2: The remainder of 1071 divided by 1029 is 42, which is put on the right, and the divisor
1029 is put on the left.
42
21
Step 3: We repeat the loop, d
ividing 1029 by 42, and get 21 as remainder.
21
0
Step 4: Repeat the loop again, since 42 is divisible by 21, we get 0 as remainder, and the
algorithm terminates. The number on the left, that is 21, is the gcd as required.
24
Observe that
a
≥
b
in each cal
l. If initially,
b
>
a
, there is no problem; the first iteration effectively swaps
the two values.
Proof
Suppose
a
and
b
are the natural numbers whose gcd has to be determined. And suppose the remainder of
the division of
a
by
b
is
r
. Therefore
a
=
qb
+
r
where
q
is the quotient of the division.
Any common divisor of
a
and
b
is also a divisor of
r
. To see why this is true, consider that
r
can be
written as
r
=
a
−
qb
. Now, if there is a common divisor
d
of
a
and
b
such that
a
=
sd
and
b
=
td
, then
r
=
(
s
−
qt
)
d
. Since all these numbers, including
s
−
qt
, are whole numbers, it can be seen that
r
is divisible
by
d
.
The above analysis is true for any divisor
d
; thus, th
e greatest common divisor of
a
and
b
is also the
greatest common divisor of
b
and
r
. Therefore it is enough if we continue searching for the greatest
common divisor with the numbers
b
and
r
. Since
r
is smaller in
absolute value
than
b
, we will reach
r
=
0
after finitely many steps.
Running time
Plot of the running time for gcd(x,y). Red indicates a fast computation, while successively bluer points
indicate slower computations
When an
alyzing the running time of Euclid's algorithm, it turns out that the inputs requiring the most
divisions are two successive
Fibonacci numbers
(because their ratios are the
convergents
in the slowest
continued fraction
expansion to converge, that of the
golden ratio
), and the worst case requires
O
(
n
)
divisions, where
n
is the number of digits in the input. However, the divisions themselves are no
t constant
time operations; the actual time complexity of the algorithm is
O
(
n
2
)
. The reason is that division of two
n

bit numbers takes time
O
(
n
(
m
+ 1))
, where
m
is the length of the quotient. Consider the computation of
gcd(
a
,
b
) where
a
and
b
have at mos
t
n
bits, let
a
0
,...,
a
k
be the sequence of numbers produced by the
algorithm, and let
n
0
,...,
n
k
be their lengths. Then
k
=
O
(
n
)
, and the running time is bounded by
25
This is considerably better than Euclid's original algorithm, in which the modulus operation is effectively
performed using repeated subtraction in
O
(2
n
)
steps. Consequently, that version of the algorithm require
s
O
(2
n
n
)
time for
n

digit numbers, or
O
(
m
log
m
)
time for the number
m
.
Euclid's algorithm is widely used in practice, especially for small numbers, due to its simplicity. An
alternative algorithm, the
binary GCD algorithm
, exploits the
binary
representation used by computers to
avoid divisions and thereby increase efficiency, although it too is
O
(
n
²); it merely sh
rinks the constant
hidden by the
big

O notation
on many real machines.
4.
Chinese remainder theorem
Suppose
n
1
,
n
2
, …,
n
k
are
integers
which are
pairwise coprime
. Then, for any given integers
a
1
,
a
2
, …,
a
k
,
there exists an integer
x
solving the system of simultaneous congruences
Furthermore, all solutions
x
to this system are congruent modulo the product
N
=
n
1
n
2
…
n
k
.
Sometimes, the simultaneous congruences can be solved even if the
n
i
s are not pairwise coprime. A
solution
x
exists if and only if:
All solutions
x
are then congruent modulo the
least common multiple
of
the
n
i
.
Versions of the Chinese remainder theorem were also known to
Brahmagupta
, and appear in
Fibonacci
's
Liber Abaci
(1202).
A constructive algorithm to find the solution
This algorithm only treats the situations where the
n
i
'
s are coprime. The
method of successive substitution
can often yield solutions to simultaneous congruences, even when the moduli are not pairwise coprime.
Suppose, as above, that a solution is needed to the system of congruences:
Again, to begin, the product
N
=
n
1
n
2
…
n
k
is defined. Then a solution
x
can be found as follows.
26
For each
i
the integers
n
i
and
N
/
n
i
are co
prime. Using the
extended Euclidean algorithm
we can therefore
find integers
r
i
and
s
i
such that
r
i
n
i
+
s
i
N
/
n
i
= 1. Then, choosing the label
e
i
=
s
i
N
/
n
i
, the above
expre
ssion becomes:
Consider
e
i
. The above equation guarantees that its remainder, when divided by
n
i
, must be 1. On the
othe
r hand, since it is formed as
s
i
N
/
n
i
, the presence of
N
guarantees that it's evenly divisible by any
n
j
so
long as
j
≠
i
.
Because of this, combined with the multiplication rules allowed in congruences, one solution to the
system of simu
ltaneous congruences is:
For example, consider the problem of finding an integer
x
such that
Using the
extended Euclidean algorithm
for 3 an
d 4×5 = 20, we fi
nd (−13) × 3 + 2 × 20 = 1, i.e.
e
1
= 40.
Using the Euclidean algorithm for 4 and 3×5 = 15, we get (−11) × 4 + 3 × 15 = 1. Hence,
e
2
= 45. Finally,
using the Euclidean algorithm for 5 and 3×4 = 12, we get 5 × 5 + (−2) × 12 = 1, meaning
e
3
= −24. A
solution
x
is therefore 2 × 40 + 3 × 45 + 1 × (−24) = 191. All other solutions are congruent to 191 modulo
60, which mean
s
that they are all congruent to 11 modulo 60.
Source for Appendix
www.answers.com
27
References
http://world.std.com/~franl/crypto/rsa

example.html
http://en.wikipedia.org/wiki/Rsa
http://en.wikipedia.org/wiki/Vigenere
http://en.wikipedia.org/wiki/book_cipher
http://en.wikipedia.org/wiki/Enigma
http://www.xat.nl/enigma/
http://www.nist.gov/dads/HTML/hash.html
http://www.imc.org/smime

pgpmime.html
http://en.wikipe
dia.org/wiki/S/MIME
http://en.wikipedia.org/wiki/One

time_pad
http://www.ranum.com/security/computer_security/papers
/otp

faq/
http://users.telenet.be/d.rijmenants/en/onetimepad.htm
http://www.pro

technix.com/inform
ation/crypto/pages/vernam_base.html
http://williamstallings.com/Extras/Security

Notes/lectures/blockA.html
http://www.burtleburtle.net/bob/hash/
http://searchsecurity.techtarget.com/sDefinition/0,290660,sid14_gci213594,00.html
http://world.std.com/~franl/crypto.html
http://axion.physics.ubc.ca/crypt.html
E.B. Vinberg (2003). A course in Algebra. American Mathematical Society.
Kjartan Poskitt (2007).
Mur
derous Math
–
Codes: How to make them and break them
.
Scholastic
Enter the password to open this PDF file:
File name:

File size:

Title:

Author:

Subject:

Keywords:

Creation Date:

Modification Date:

Creator:

PDF Producer:

PDF Version:

Page Count:

Preparing document for printing…
0%
Σχόλια 0
Συνδεθείτε για να κοινοποιήσετε σχόλιο