Implementation of Cryptographic Algorithms and 4
Implementation of Cryptographic Algorithms and 4
Bachelor of Technology
in
Computer Science and Engineering
By
OMKAR GURU
SANJAY MAJUMDAR
KRITHIKA K
1
National Institute of Technology
Rourkela
CERTIFICATE
This is to certify that the thesis entitled, “Implementation of cryptographic algorithms and
protocols” submitted by Sri Omkar Guru , Ms Krithika K and Sri Sanjay Majumdar in
partial fulfillments for the requirements for the award of Bachelor of Technology Degree
in Computer Science Engineering at National Institute of Technology, Rourkela (Deemed
University) is an authentic work carried out by him under my supervision and guidance.
To the best of my knowledge, the matter embodied in the thesis has not been
submitted to any other University / Institute for the award of any Degree or Diploma.
Date: Prof.B.Majhi
Dept. of Computer Science Engineering
National Institute of Technology
Rourkela - 769008
2
ACKNOWLEDGEMENT
We would like to articulate our deep gratitude to our project guide Prof. Majhi
who has always been our motivation for carrying out the project. It is our pleasure to
refer Microsoft Word exclusive of which the compilation of this report would have been
impossible. An assemblage of this nature could never have been attempted with out
reference to and inspiration from the works of others whose details are mentioned in
reference section. We acknowledge out indebtedness to all of them. Last but not the least
, our sincere thanks to all of our friends who have patiently extended all sorts of help for
accomplishing this undertaking.
OMKAR GURU
K.KRITHIKA
SANJAY MAJUMDAR
3
CONTENTS
Page No
Abstract
List of Figures
List of Tables
2.1 Introduction 4
2.2 Cryptography 4
2.3 Conventional encryption model 6
2.4 Key Distribution-Conventional Cryptography 7
2.5 Cryptanalysis 8
2.6 Classical encryption techniques 9
2.7 Self-repetitive method for hill cipher 12
2.8 Poly-alphabetic cipher 15
2.9 Transposition scheme 16
2.10 Data Encryption Standard 16
2.11 Advanced Encryption standard 20
2.12 Conclusion 23
3.1 Introduction 25
3.2 Basic Principles 25
3.3 Advantages of Public Key Cryptography 27
3.4 RSA algorithm 29
3.5 Elliptic curve cryptography 30
3.6 Conclusion 33
Chapter 4 DIGITAL SIGNATURE PROTOCOLS 34
4.1 Introduction 35
4.2 Authentication system using RSA signature 35
4.3 Digital signature algorithm 36
4.4 Conclusion 37
Chapter 5 IMPLEMENTATION AND RESULTS 38
4
5.2 Public key cryptography 41
5.3 Digital signature protocol 43
5.4 Hill cipher using self-repetitive matrix 45
Chapter 6 CONCLUSIONS 54
REFERENCES 56
5
Chapter 1
INTRODUCTION
6
INTRODUCTION:
The purpose of the project is to provide a practical survey of both the principles and
practice of cryptography. Cryptography has become an essential tool in transmission of
information. Cryptography is the central part of several fields: information security and
related issues, particularly, authentication, and access control. Cryptography encompasses
a large number of algorithms which are used in building secure applications.
AUTHORS CONTRIBUTION:
The authors have implemented cryptographic algorithms of both the conventional
symmetric key cryptography as well as public key cryptography. DES, AES and Hill
Cipher have been implemented for the Symmetric key. RSA and ECC have been
implemented for Public key cryptography. Digital Signature Verification Protocols like
DSA and RSA were implemented. In DSA, SHA1 was used for hashing and in RSA,
MD5 was used. A complete JAVA package was developed on these algorithms.
The authors have also implemented an alternate method to the conventional
cryptographic technique of HILL-CIPHER using the concept of self repetitive matrix. A
numerical method has been described and later implemented in generating a random
matrix of given periodicity. The method of self repetitive matrix has then been used to
simulate a communication channel with proper decompression techniques to facilitate bit
saving. This method is easier to implement compared to other techniques like self
invertible matrix etc. and if the block size and the modular index is suitably chosen the it
becomes extremely tough to crack it by known plaintext attack as it is infeasible to find
either the key matrix or the session key used for encryption.
7
Chapter 2
CONVENTIONAL ENCRYPTION
8
2.1 Introduction
Conventional Encryption is referred to as symmetric encryption or single key encryption.
It was the only type of encryption in use prior to the development of public-key
encryption. Conventional encryption can further be divided into the categories of
classical and modern techniques. The hallmark of the classical technique is that the cipher
or the key to the algorithm is shared i.e. known by the parties involved in the secured
communication. So there are two types of cryptography: secret key and public key
cryptography .In secret key same key is used for both encryption and decryption. In
public key cryptography each user has a public key and a private key. In this chapter a
very view of conventional cryptography is presented. In the section 2.8 a new method of
cipher developed by author has been presented
2.2 Cryptography:
Cryptography is the study of Secret (crypto-)-Writing (-graphy). It is the science or art of
encompassing the principles and methods of transforming an intelligible message into
one that is intelligible and then transforming the message back to its original form. As the
field of cryptography has advanced; cryptography today is assumed as the study of
techniques and applications of securing the integrity and authenticity of transfer of
information under difficult circumstances.
A digital signature binds a document to the possessor of a particular key, while a digital
timestamp binds a document to its creation of a particular time. These cryptographic
9
mechanisms can be used to control access to shared disk drive, a high security
installation, or a pay-per-view TV channel. The field of cryptography encompasses
other uses as well. With just a few basic cryptographic tools, it is possible to build
elaborate schemes and protocols that allow us to pay using electronic money, to prove we
know certain information without revealing the information itself, and to share quantity
in such a way that a subset of the shares can reconstruct the set. While modern
cryptography is growing increasingly diverse, cryptography is fundamentally based on
problems that are difficult to solve. A problem may be difficult because its solution
requires some secret knowledge such as decrypting an encrypted message or signing
some digital document.
Steganography, hiding one message inside another, is an old technique that is still in use.
For example, a message can be hidden inside a graphics image file by using the low order
bit of each pixel to encode the message. The visual effect of these tiny changes is
probably too small to be noticed by the user. The message can be hidden further by
compressing it or by encrypting it with a conventional cryptosystems. Unlike
10
conventional cryptosystems, where we assume the attacker knows everything about the
cryptosystem except for the secret key, Steganography relies on the secrecy of the
method of hiding for its security. If eve does not recognize the message as cipher text,
then she is not likely to attempt to decrypt it.
11
2.4 Key Distribution-Conventional Cryptography:
The strength of any cryptographic system rests on the key distribution technique.
Conceivably for two parties: A could select a key and hand delivers it to B, or A and
could rely on a trusted courier. If A and B have an established secure connection, they
could exchange a key via encrypted messaging, or if A and B have a established secure
connection via a third party C,C could provide this trusted courier service. The first two
situations could provide a logistical nightmare if the number of communicating parties
increase, the number of discrete keys needed also increases exponentially. In option,
weaknesses are revealed, that if an attacker ever is able to compromise any one key it can
compromise all the keys i.e. attacker can masquerade as the third party. The fourth option
demonstrates a Key Distribution Center (KDC) which is largely adopted. A KDC is
responsible for securely delivering unique key pair to its clients. It is also responsible for
key management. A key management center uses a hierarchy of keys to provide
authentication, integrity, no repudiation, and confidentiality to its users. The hierarchy of
keys consists of session keys, which are used for logical connection between end users.
The session keys are encrypted by a master key which is shared by the KDC and an end
user. Consider this classic key distribution scenario: A uses his secret key to request a
session key from KDC to establish a logical connection with B. The request includes both
the identities of A and B and a unique identifier for the transaction. A is a contrivance
invented or used for this particular, singular occasion. The replies to A with encrypted
message which contains the requested one time session key and the original message
with the nonce. The original message is used to verify the reply’s integrity. The nonce is
used by the requestor to verify that the returned message is not a replay of an older
request.
The reply also contains two items relating to B. They are the one time session key, to be
used for by session and an identifier for A. Both these items are encrypted with the
master key shared by KDC and B. The items are used to authenticate A and B. Party A
forwards to B the information that originated at KDC, that was encrypted with B’s master
key. This gives the process its integrity.
12
For B to be authenticated to A the following steps should occur: Party B now uses the
logical connection created by the shared session key to send a half defined nonce to A.
Upon receipt of B defined nonce, A performs a mathematical function on the nonce; A
performs a mathematical function on the nonce and returns result to B through the logical
connection. The keys have to manage across KDC domains. Keys issued to an entity by
one KDC have to validate by the issuer before they can be accepted by an entity serviced
by a different issuer. The issuers have to collaborate on acceptable method of
authenticating inter-domain transaction. Currently, KDCs use a hierarchy for key sharing.
Each local KDC negotiates keys for its subscribers through a global KDC. Session
generated must have a finite lifetime. Keys are exchanged frequently to prevent an
opponent from having a large amount of data encoded with the same key. This brings us
to the subject of cryptanalysis.
2.5 Cryptanalysis:
Code making involves the creation of encryption products that provide protection of
confidentiality. Code breaking involves defeating this protection by some mens other
than the standard decryption process used by a intended recipient. Five scenarios for
which code breaking is used. They are ensure accessibility, spying on opponents, selling
cracking products and services, pursuing the intellectual aspects of code breaking and
testing whether one’s codes are strong enough. Cryptanalysis is the process of attempting
to discover either the plaintext Xp or the key K. Discovery of the encryption is the most
desired one as with its discovery all the subsequent messages can be deciphered.
Therefore, the length of encryption key, and the volume of the computational work
necessary provides for its strength i.e. resistance to breakage. The longer the key, the
stronger the protection, the more brute force is needed. Neither conventional encryption
nor public key encryption is more resistant to cryptanalysis than the other. All that the
user of an encryption algorithm can strive for is an algorithm that meets one or both of
the following criteria: the cost of breaking the cipher exceeds the value of the encrypted
information, the time required to break to exceeds the normal lifetime of the information.
13
2.6 Classical encryption techniques:
The technique enables us to illustrate the basic approaches to conventional encryption
today. The two basic components of classical ciphers are substitution and transposition.
Then other systems described that combines both substitution and transposition.
14
English i.e. ‘e’ or maybe ‘t’. She can assume then that the most frequent letter ‘b1’ in c is
‘e’, the next most frequent letter b2 in ‘t’., and so forth. Of course, not all these guesses
will be correct, but the number of likely candidates for each cipher text letter is greatly
reduced. Moreover, many wrong guesses can quickly discarded eve without constructing
the entire trial key because they lead to unlikely letter combinations.
If two letters are in the same column of the matrix, use letter below it as the cipher text.(
columns are cyclical).
15
If two letters are in the same row of the matrix, use letter to the right as the cipher text.(
columns are cyclical).
If neither the same column or row, then each are exchanged with the letter at the
intersection of its own row and the other column.
For encryption, algorithm takes m successive plaintext letters and instead of that
substitutes m cipher letters. In Hill cipher each character is assigned a numerical value
like:
a=0,
b=1,
…..
…..
z=25.
The substitution of cipher text letters in place of plaintext leads to m linear equations. For
m=3, the system can be described as follows:
C1=(K11P1+K12P2+K13P3) MOD26--------- (2.3)
C1=(K21P1+K22P2+K23P3) MOD26--------- (2.4)
C1=(K31P1+K32P2+K33P3) MOD26--------- (2.5)
16
This can be expressed in terms of column vectors and matrices:
C=KP
Where C and P are column vectors of length 3, representing the plaintext and the cipher
text and K is a 3*3 matrix, which is the encryption key. All operations are performed
mod 26 here. Decryption requires the inverse of matrix K. The inverse K-1 of a matrix K
is defined by the equation.
K K-1= I where I is the Identity matrix.
NOTE: The inverse of a matrix doesn’t always exist, but when it does it satisfies the
proceeding equation.
K-1 is applied to the cipher text, and then the plain text is recovered. In general terms we
can write as follows:
For encryption: C=E(K, P)=KP
For decryption: P=D ( K, C ) =K-1 C= K-1KP=P
In order to overcome this problem author suggests the use of self-repetitive matrix.
This matrix if multiplied with itself for a given mod value (i.e. mod value of the matrix is
taken after every multiplication) will eventually result in an identity matrix after N
multiplications. So, after N+ 1 multiplication the matrix will repeat itself.
Hence, it derives its name i.e. self-repetitive matrix. It should be non-singular square
matrix.
Note: Historically, there are already many available methods, like self-invertible
matrix etc. But this method as suggested by the author is both easy to compute and
simpler to implement.
17
2.7.1 Modular Arithmetic: A brief Analysis
The analysis presented here for generation of self-repetitive matrix is valid for matrix of
positive integers that are the residues of modulo arithmetic on a prime number. So in
analysis the arithmetic operations presented here are addition, subtraction, Unary
operation, Multiplication and division.
18
5. Inverse For each X belongs to zp , there exists y such that
(x + y) mod p =0 then y= -x
For each X belongs to zp, there exists y such that (x*y)
mod p=1
But trying to find out the value of N (the value where the matrix becomes a identity
matrix) through the method of brute force may not be the best idea always; because
the matrix is of dimension greater than 5*5 and with mod index (i.e.) greater than 91
then the brute force technique might take very long time and N value may be in the
range of millions. A normal Pentium 4 machine might hang if asked to do the
computations for 15*15 matrixes or more.
Hence, it would be comfortable to know the value of N and then generate a random
matrix accordingly.
This can be done as follows:
19
1. First a diagonal matrix A is chosen, and then the values powers of each individual
element when they reach unity is calculated and denoted as n1, n2, n3…. Now
LCM of these values is taken to given the value of N.
2. Now the next step is generate a random square matrix whose N value is same as
the N calculated in the previous step.
3. Pick up any random invertible square matrix B
4. Generate C=B-1AB
5. The N value of C is also N
Mathematical proof:
(B-1AB)N= (B-1) N*(A) N*(B) N
AN=I as calculated before as it is a diagonal matrix and N is the LCM of all elements
(B-1B)*(B-1*B)…n times=I
NOTE: The algorithm for hill cipher matrix using self-repetitive matrix is given
in the implementation chapter. For further illustration, a simple example has
been explained with each step in the implementation chapter.
20
2.9 Transposition Scheme:
Transposition (or permutation) does not alter any of the bits in the plaintext, but instant
moves the position around within it. If thr resultant Cipher text is then put through more
transpositions, the end result has increasing security.
The National Bureau of Standards with the help of the National Security Agency
developed it in the 1970s. Its purpose is to provide a standard method for sensitive
commercial and unclassified data. IBM created the first draft of the algorithm, calling it
LUCIFER. DES officially became a standard in November of 1976.
Data encryption algorithm has a 64-bit block size and uses a 56bit key during execution
(8 parity bits are stripped of from the full 64-bit key). The DEA can also be used for
single user encryption, such as to store files in a hard in encrypted form. NIST re-certifies
DES every 5 years. DES has been in world wide use for over 20 years, and due to the fact
21
that it is a defined standard that any system implementing DES can communicate with
any other system using is it.
Initially a transposition is carried out according to a set table (the initial permutation), the
64-bit plaintext block is then split into two 32-bit block, and 16 identical operations
called rounds are carried out on each half. The two halves are joined back together , and
the reverse of the initial permutation is carried out. The purpose of the first transposition
is clear; it does not affect the security of the algorithm, but is through for the purpose of
allowing plaintext and cipher text to be loaded into 8-bit chip in byte-sized pieces. In any
round, only one half of the original 64-bit block is operated on. The rounds alternate
between the two halves. One round in DES consists of the following:
22
simultaneously by allowing the first and fourth bits in each block for bit block to appear
twice in the output that is the fourth input bit becomes the fifth and the seventh output bit.
2.10.4 XOR:
XOR operation performed with the appropriate subset key for that round & the resulting
48 block.
2.10.5 Substitution:
After XOR operation the next operation is to perform substitution on the expanded block.
There are 8 substitution boxes called S-boxes. The first S-Box operates on the first 6 bits
of the 48 bit expanded block, the second S-box on the next 6 & so on. Each S-box
operates from a table of 4 rows & 16 columns; each entry on a table is a 4 bit number.
The 6 bit number the s-box takes as input is used to look up the appropriate entry in the
table in the following way. The first and the 6 bits combine to form a two bit number
23
corresponding to a row number, the second and fifth bit combine to form a 4 bit number
corresponding to a particular column. The net result of the substitution phase is 8 4bit
blocks that are then combined to form a 32 bit block. It is the non-linear relationship of
the S-boxes that really provides DES with its security.
2.10.6 Permutation:
The 32 bit output of a substitution phase then undergoes a straight forward transposition
using a table called P-Box. After all the round has been completed, the two half blocks of
32 bits are recombined to form a 64 bit output. The final permutation is performed on it,
and the resulting 64 bit block is the desired DES encrypted cipher text of the input plain
text block.
24
• Design simplicity.
25
8. The final round of both encryption and decryption consists of only three stages.
This is a consequence of the particular structure of AES and is required to make the
cipher reversible.
26
2.12 Conclusion:
There are several methods of conventional cryptography, and since it is not possible to
present all the methods, very important and popular methods were presented and
implemented.
It is seen that the modified Hill cipher Encryption and Decryption requires generating
random Matrix, which is essentially the power of security. As we know in Hill cipher
Decryption requires inverse of the matrix. Hence while decryption one problem arises
that is. Inverse of the matrix does not always exist. Then if the matrix is not invertible
them encrypted text cannot be decrypted. But this drawback is completely eliminated in
modified Hill cipher algorithm.
At the same time, this method requires the cracker to find the inverse of many square
matrices, which is not computationally easy. So this modified Hill-Cipher method is both
easy to implement and difficult to crack.
27
Chapter 3
PUBLIC-KEY CRYPTOGRAPHY
28
3.1 Introduction:
Public-Key Algorithms are symmetric, that is to say the key that is used to encrypt the
message is different from the key used to decrypt the message. The encryption key,
known as the Public key is used to encrypt a message, but the message can only be
decoded by the person that has the decryption key, known as the private key.
This type of encryption has a number of advantages over traditional symmetric Ciphers.
It means that the recipient can make their public key widely available- anyone wanting to
send them a message uses the algorithm and the recipient's public key to do so. An
eavesdropper may have both the algorithm and the public key, but will still not be able to
decrypt the message. Only the recipient, with the private key can decrypt the message.
A advantage of public-key algorithm is that they are more computationally intensive than
symmetric algorithms, and therefore encryption and decryption take longer. This may not
be significant for a short text message, but certainly is for bulk data encryption.
In order to decrypt a message, Bob (the recipient) has to know the key. However, it may
be difficult for Alice (the sender) to tell Bob what the key is. If they simply agree on a
key bye-mail for example, Eve could be listening in on their e-mail conversation and thus
also learn what the key is. Public key cryptography was invented to solve this problem.
When using public-key cryptography, Alice and Bob both have their own key pairs. A
key pair consists of a public key and a private-key. If the public-key is used to encrypt
something, then it can be decrypted only using the private-key. And similarly, if the
private-key is used to encrypt something, then it can be decrypted only using the public-
29
key. It is not possible to figure out what the private-key is given only the public-key, or
vice versa.
This makes it possible for Alice and Bob to simply send their public keys to one another,
even if the channel they are using to do so is insecure. It is no problem that Eve now gets
a copy of the public keys. If Alice wants to send a secret message to Bob, she encrypts
the message using Bob's public key. Bob then takes his private key to decrypt the
message. Since Eve does not have a copy of Bob's private key, she cannot decrypt the
message. Of course this means that Bob has to carefully guard his private key. With
public key cryptography it is thus possible for two people who have never met to securely
exchange messages. Figure 3.1 illustrates the public-key encryption process.
30
3.3 Advantage and Disadvantage of Public-Key Cryptography:
31
his or her private key. This property of public-key authentication is often called
non-repudiation.
32
functions. Secret-key cryptography remains extremely important and is the subject of
ongoing study and research. Some secret-key cryptosystems are discussed in the sections
on Block Cipher and Stream Cipher.
The RSA cryptosystem, named after its inventors R. Rivest, A. Shamir, and L. Adleman,
is the most widely used public key Cryptosystem. It may be used to provide both secrecy
and digital signatures and its security is based on the intractability of the integer
factorization.
Two very large prime numbers, normally of equal length, are randomly chosen then
multiplied together.
N =A x B (3.1)
T = (A-1) x (B-1) (3.2)
A third number is then also chosen randomly as the public key (E) such that it has no
common factors (i.e. is relatively prime) with T. The private key (D) is then:
D = E-1mod T (3.3)
C = ME mod N (3.4)
To Decrypt:
M = CD mod N (3.5)
33
3.4.2 Security of RSA:
The security of RSA algorithm depends on the ability of the hacker to factorize numbers.
New, faster and better methods for factoring numbers are constantly being devised. The
Trent best for long numbers is the Number Field Sieve. Prime Numbers of a length that
was unimaginable a mere decade ago are now factored easily. Obviously the longer a
number is, the harder is to factor, and so the better the security of RSA. As theory and
computers improve, large and large keys will have to be used. The advantage in using
extremely long keys is the computational overhead involved in encryption / decryption.
This will only become a problem if a new factoring technique emerges that requires keys
of such lengths to be used that necessary key length increases much faster than the
increasing average speed of computers utilizing the RSA algorithm. RSA's future
security relies solely on advances in factoring techniques.
Public key cryptography systems are usually based on the assumption that a
particular mathematical operation is easy to do, but difficult to undo unless you know
some particular secret. This particular secret serves as the secret key. A recent
development in this field is the so-called Elliptic Curve Cryptography.
Elliptic Curve Cryptography works with point on a curve. The security of this type of
public key cryptography depends on the elliptic curve discrete logarithm problem.
Elliptic curve cryptography was invented by Neil Koblitz in 1987 and by Victor
Miller in 1986. The principles of elliptic curve cryptography can be used to adapt
many cryptographic algorithms, such as Diffie-Hellman or EIGamal. Although no
general patent on elliptic curve cryptography appears to exist, there are several
patents that may be relevant depending on the implementation. The main advantage
of elliptic curve cryptography is that the keys can be much smaller. Recommended
key sizes are in the order of 160 bits rather than 1024 bits for RSA.
34
3.5.1 Elliptic Curves:
An elliptic curve is a set of points (x, y), for which it is true that
y2 = x3 + ax + b (3.21)
Given certain chosen numbers a and b. Typically the numbers are integers (whole
numbers), although in principle the system also works with real (fractional) numbers.
Despite what the name suggests, the curves do not have an elliptic shape. For
example, -4 and b = 0.67 gives the elliptic curve with equation y2= x3 - 4x + 0.67.
This curve is illustrated in Figure 3.2.
35
For cryptographic purposes, an elliptic curve must have only points with all
coordinates whole numbers (integers) in the group.
The trick with elliptic curve cryptography is that if you have a point F on the curve,
all multiples of these points are also on the curve [22, 23].
36
second, this takes about 38 million years. This problem is commonly referred to as the
elliptic curve discrete logarithm problem.
3.6 Conclusion:
Brief review of public-key cryptography is presented in this chapter. Also some popular
public-key cryptography methods presented briefly. Public- key algorithms are based on
mathematical functions rather than on substitution and permutation. Hence the advantage
of public key algorithm is that they are more computationally intensive than symmetric
algorithms. More important, public-key cryptography is asymmetric involving the use of
two separate keys, in contrast to symmetric conventional encryption, which uses only one
key. The use of two keys has profound consequences in the areas of confidentiality, key
distribution and authentication. The implementation of RSA algorithm and ECC are
shown in the implementation chapter.
37
Chapter 4
38
4.1 Introduction
RSA san be used for Digital Signature. For Digital signature the message is first
encrypted by private key of sender and encryption is done by public key of receiver.
This gives confidentiality and authentication. MD5 can be used for preparing a
message digest which is encrypted along with the message and sent to the receiver
for verification.
The general algorithm used can be summed up as:
4.2.1 Sender:
4.2.2 Receiver:
39
3. If z = h(m), the signature is valid
4.3.2 Signing:
40
The extended Euclidean algorithm can be used to compute the modular inverse k-1
mod q.
4.3.3 Verifying:
1. Reject the signature if either 0< r <q or 0< s <q is not satisfied.
2. Calculate w = (s)-1 mod q
3. Calculate u1 = (SHA(m)*w) mod q
4. Calculate u2 = (r*w) mod q
5. Calculate v = ((gu1*yu2) mod p) mod q
4.4 Conclusion:
41
Chapter 5
42
5.1 SYMMETRIC KEY CRYPTOGRAPHY:
1. AES
AES is implemented in java platform with variable key length. The output is
shown in an interactive applet interface.
43
2. DES
DES is implemented in C++. The user has choice of encryption or
decryption. The input is taken of 64 bits. Either 8 ASCII characters or 16 HEX
characters can be given for converting to cipher text. The key is again of 64 bits given
by the user. The output (cipher text) is shown in hexadecimal. The cipher text can be
decrypted using shared secret key.
44
5.2 PUBLIC KEY CRYPTOGRAPHY:
1. RSA
RSA algorithm is used for encryption and decryption (public key
cryptography). Key length is variable up to 1024 bits.
45
2. ECC
ECC algorithm is used for encryption and decryption. The program is
implemented in JAVA. Elliptic curve public key and private key are generated on
each instance and corresponding points on curve for given input generated and
converted to cipher
46
5.3 DIGITAL SIGNATURE PROTOCOLS:
1. DSA
Digital signature algorithm is implemented. SHA1 is used for hashing
47
2. AUTHENTICATION SYSTEM- RSA SIGNATURE USING MD5 FOR
HASHING
The input message is hashed using MD5 to give 128 bit Message Digest.
The message as well as message digest is encrypted using RSA.
48
5.3 HILL CIPHER USING SELF-REPETITIVE MATRIX:
49
5.3.2 STEPS AT THE TRANSMITTER SIDE:
NOTE: THE ALGORITHM FOR CONVERSION INTO MACHINE CODE HAS BEEN
DISCUSSED LATER.
50
5.3.4 METHOD FOR COMPRESSION INTO HEX CODE:
51
5.3.5 A SMALL ILLUSTRATIVE EXAMPLE FOR HILL CIPHER USING SELF
REPETITIVE MATRIX:
For easy illustration, we have taken a two block matrix, here to explain.
STEPS:
Take a plaintext of two blocks to be P= [1 2]
1. MOD_VAL= 5
2. Calculate N:
4. We are now interested in a matrix C whose value will be the same identity
matrix if raised to the power N under MOD_VAL.
6. Now C=BAB-1
C= [2 1; 1 2]*[2 0; 0 3]*[2 4; 4 2]
C= [0 2; 3 0]
Now C is the desired hill cipher matrix.
1. Encryption E= CN-M * P
E= [0 2; 3 0]5* [1 2]
E= [4 3]
52
Steps at the receiving side:
1. Decryption D= CM*E
2. D=[0 2; 3 0]3*[4 3]
3. D=[1 2] = P
53
5.3.1 HILL CIPHER USING SELF-REPETITIVE MATRIX:
Hill cipher using self-repetitive matrix has been implemented in MATLAB. At first,
we considered the message for 5 blocks and simulated the algorithm on both sender
and receiver side.
1. TRANSMITTER SIDE
54
2. RECIEVER SIDE
55
2. TRANSMITTING WITH FILE
56
3. RECEIVE WITH FILE
57
Chapter 6
CONCLUSION
58
CONCLUSION
The existing algorithms of symmetric key and public key cryptography are studied in
detail and implemented using platforms like C++ and Java. A complete package which
includes all the algorithms was developed.
The Hill cipher technique using self-repetitive matrix was successfully implemented
in MATLAB. A communication channel was successfully modeled which used
proper decompression techniques for effective communication. The numerical
method suggested to find N value of a matrix was successfully tested and used in the
implementation. It was found to be easier to compute and simpler to implement and
difficult to crack.
59
REFERENCES
[1] W.Stallings; “Cryptography and Network Security” 2nd Edition, Prentice Hall,
1999
[2] Bruce Schneir: Applied Cryptography, 2nd edition, John Wiley & Sons, 1996
[4] Abrams, M., and Podell, H. “Cryptography” Potentials, IEEE Page No 36-38.
Issue: 1, Volume: 20, Feb-Mar, 2001
[5] Eskiciogiu, A. Litwin,L “ Cryptography and Network Security” LOS Alamitos,CA:
IEEE computer society press,1987
[6] Garfinkel, S.L; “Public Key Cryptography”, Computer, IEEE, Volume: 29, Issue:
6, June 1996.
[8] E.Biham and A.Shmir; “Differential C for Cryptanalysis of the Encryption
Standard”; Springer- Verilag, 1993
[9] Bidjos, J; “Threats to Private and Public Key Protection”, Compcon Spring ’91.
Digest of Papers, 25 Feb-1 March 1991
[10] V. Miller; “Uses of Elliptic Curves in Cryptography. In advances in
Cryptography, Springer Verlag Crypto 95.
60
61