Implementation of Data Encryption Standard Algorithm

advertisement
Implementation of Data Encryption Standard Algorithm
1Harshala
B. Pethe
Research Scholar
Department of Electronics & Comp. Sc.
RTMNU, Nagpur (India).
harshapethe@gmail.com
ABSTRACT
Cryptography plays an important role for
performing the secured communication through an unsecured
channel and creating the secured environment. There are
various algorithms used for this purpose. Mainly these
algorithms are classified into two types: symmetric key and
asymmetric key cryptographic algorithms. This paper deals
with the implementation of Data Encryption Standard
algorithm, which is one of the symmetric key cryptography
algorithm. The m file DES.m is created and the two functions
encrypt() and decrypt() are called into this file. This m file
DES.m gives the time required for encryption and decryption
in seconds for the entered text.
Keywords
DES, symmetric key cryptography, encryption, decryption,
Cryptographic algorithms.
1. INTRODUCTION
Cryptography is the technique used to avoid
unauthorized access of data. Data can be encrypted
using a cryptographic algorithm by using different keys.
It is transmitted in an encrypted state, and decrypted by
the intended party. If a third party intercepts the
encrypted data, it will be difficult to decipher. The
security of modern cryptosystems is not based on the
secrecy of the algorithm, but on the secrecy of a
relatively small amount of information, called a secret
key[1].
Cryptography plays an important role in the
security to maintain the confidentiality, authentication,
integrity and non- repudiation of the information and
encryption is the backbone of cryptography[2]. There
are two major types of cryptographic algorithms
Symmetric key and asymmetric key cryptographic
algorithm. Symmetric key cryptographic algorithms use
the same key for both encryption and decryption.
Asymmetric key or public key cryptographic algorithms
use two different keys for encryption and decryption.
This paper deals with the detailed study and
implementation of Data Encryption Standard (DES)
algorithm.
The Data Encryption Standard (DES), known
as the Data Encryption Algorithm (DEA) by ANSI and
the DEA-1 by the ISO[3] DES is a block cipher; it
encrypts data in 64-bit blocks. A 64-bit block of
2Dr.
Subhash. R. Pande
Department of Computer Science,
SSESA’s Science College,
Nagpur.(India)
srpande65@rediffmail.com
plaintext goes in one end of the algorithm and a 64-bit
block of ciphertext comes out the other end. DES is a
symmetric algorithm: The same algorithm and key are
used for both encryption and decryption.
It was the first encryption standard to be
published by NIST (National Institute of Standards and
Technology). It was designed by IBM. DES became a
standard in 1974[4].
The key length is 56 bits which is usually
expressed as a 64-bit number. Every eighth bit is used
for parity checking and is ignored. These parity bits are
the least-significant bits of the key bytes. The key can
be any 56-bit number and can be changed at any time.
2. GOALS
2.1 Confidentiality
Confidentiality means protection against
unauthorized disclosure of information. It may be
applied to whole messages, parts of messages, and even
existence of messages. Confidentiality provides the
protection of transmitted data from passive attacks.
2.2 Authentication
The process of proving one’s identity. This
includes verifying the message’s source. Authentication
is of two types: (i) Peer entity authentication , and (ii)
Data origin authentication.
2.3 Data integrity
The integrity is an assurance that the message
has not been modified. This can be applied to a stream
of messages, a single message, or selected fields within
a message. It assures that messages are received as sent,
with no duplication, insertion, modification, reordering,
or replays.
2.4 Access control
It is the ability to limit and control the access
to host systems and applications via communications
links. To achieve this, each entity trying to gain access
must first be identified, or authenticated, so that access
rights can be tailored to the individual.
2.5 Non repudiation
Sender or receiver cannot deny for a
transmitted message. When a message is sent, the
receiver can prove that the sender in fact sent the
message. [1]
3. MODES OF ENCRYPTION AND
DECRYPTION
For providing the flexibility DES can operate
in CBC, ECB, CFB and OFB modes. [4, 5]
3.1 Electronic Code Book (ECB)
In this mode data is divided into 64-bit blocks
and each block is encrypted one at a time. Separate
encryptions with different blocks are totally
independent of each other. This means that if data is
transmitted over a network or phone line, transmission
errors will only affect the block containing the error. It
also means, however, that the blocks can be rearranged,
thus scrambling a file beyond recognition, and this
action would go undetected. ECB is the weakest of the
various modes because no additional security measures
are implemented besides the basic DES algorithm.
However, ECB is the fastest and easiest to implement.
It is the most common mode of DES in commercial
applications. This mode of operation is used by Private
Encryptor.
3.2 Cipher Block Chaining (CBC)
In this mode, each block of ECB encrypted
ciphertext is XORed with the next plaintext block to be
encrypted, therefore all the blocks are dependent on the
previous blocks. This means that in order to find the
plaintext of a particular block, we need to know the
ciphertext, the key, and the ciphertext for the previous
block. The first block to be encrypted has no previous
ciphertext, so the plaintext is XORed with a 64-bit
number called the Initialization Vector(IV). So if data is
transmitted over a network or phone line and there is a
transmission error (adding or deleting bits), the error
will be carried forward to all subsequent blocks since
each block is dependent upon the last. If the bits are just
modified in transit the error will only affect all of the
bits in the changed block, and the corresponding bits in
the following block. The error doesn't propagate any
further. This mode of operation is more secure than
ECB.
This mode of operation is similar to CBC and is very
secure, but it is slower than ECB due to the added
complexity.
3.4 Output Feedback (OFB)
This is similar to CFB mode, except that the
ciphertext output of DES is fed back into the Shift
Register, rather than the actual final ciphertext. The
Shift Register is set to an arbitrary initial value, and
passed through the DES algorithm. [4]
4. OVERVIEW OF DES
DES operates on a 64-bit block of plaintext.
After an initial permutation, the block is broken into a
right half and a left half, each 32 bits long. Then there
are 16 rounds of identical operations, called Function f,
in which the data are combined with the key. After the
sixteenth round, the right and left halves are joined, and
a final permutation (the inverse of the initial
permutation) finishes off the algorithm.
At its simplest level, the algorithm is nothing
more than a combination of the two basic techniques of
encryption: confusion and diffusion. The fundamental
building block of DES is a single combination of these
techniques (a substitution followed by a permutation)
on the text, based on the key. This is known as a round.
DES has 16 rounds; it applies the same combination of
techniques on the plaintext block 16 times as shown in
figure 1 [3].
3.3 Cipher Feedback (CFB)
Blocks of plaintext those are less than 64 bits
long can be encrypted in this mode. Special processing
has to be used to handle files whose size is not a perfect
multiple of 8 bytes. The plaintext itself is not actually
passed through the DES algorithm, but merely XORed
with an output block from it, in the following manner:
A 64-bit block called the Shift Register is used as the
input plaintext to DES. This is initially set to some
arbitrary value, and encrypted with the DES algorithm.
Figure 1 : Data Encryption Standard
Li = Ri-1
6. RESULTS
Ri = Li-1 f (Ri-1, Ki)
The following table shows the encryption time
and decryption time required for the different text data
keeping key constant :
The Process of DES:




DES uses 16 rounds of Feistel network process
to generate the cipher text
The plain text been divided into each 64bit
blocks.
For each round we use 48bit key as an input
for the round generation from the 56bit key
using permutation and left circular shit
operations.
In the DES the entire security is depends up on
the 16 round generation process. [6]
In each round, data and key bits are shifted,
permutated, XORed, and sent through, 8 s-boxes. [7]
5. IMPLEMENTATION
The DES algorithm is implemented using
MATLAB. The user have to input the text to be
encrypted and the key for encryption and press ok the
encrypted data will be displayed in the edit box. Then
the user have to enter the key for decryption and press
ok, the decrypted data will be displayed in the text box.
The time required for encryption and decryption is also
calculated.
Table 1 : Encryption and decryption time for
different text keeping key constant
Sr.
No
Data
Key
Encryption
time
Decryption
time
1
Text 1
ABCDEF1234ABCDEF
0.066395
0.193989
2
Text 2
ABCDEF1234ABCDEF
0.132675
0.195513
3
Text 3
ABCDEF1234ABCDEF
0.190167
0.25667
4
Text 4
ABCDEF1234ABCDEF
0.188951
0.248324
5
Text 5
ABCDEF1234ABCDEF
0.246914
0.313305
6
Text 6
ABCDEF1234ABCDEF
0.256733
0.316542
7
Text 7
ABCDEF1234ABCDEF
0.374363
0.433695
8
Text 8
ABCDEF1234ABCDEF
0.433844
0.493131
9
Text 9
ABCDEF1234ABCDEF
0.637822
0.48726
10
Text 10
ABCDEF1234ABCDEF
0.643873
1.10026
The results are analysed for the different text data,
keeping key constant. The time required for encryption
and decryption for the different text data is shown in the
following graph.
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
text 1
text 2
text 3
text 4
text 5
text 6
text 7
text 8
text 9
text 10
Encryption
Time
Figure 3: Time required for encryption
The time required for decryption for the different text
data is shown in the following graph.
Figure 2: Tool for DES
Blowfish: Symmetric Key Cryptography Algorithms
Simulation Based Performance Analysis. IJETAE ISSN
2250-2459, Volume 1, Issue 2.
1.2
1
[5] Mandal, A. K., Parakash, C., & Tiwari, A. (2012).
Performance Evaluation of Cryptographic Algorithms:
DES and AES. IEEE .
0.8
0.6
Decryption
Time
0.4
[7] Soni, S., Agrawal, H., & Sharma, D. (December 2012).
Analysis and Comparison between AES and DES
Cryptographic Algorithm. IJEIT , Volume 2, Issue
6, 362-365.
0.2
text 1
text 2
text 3
text 4
text 5
text 6
text 7
text 8
text 9
text 10
0
Figure 4 :Time required for decryption
Time in seconds
[6] Addagarla, S. K., & Babji. (July 2013 ). A Comparative
Security Study Review on Symmetric Key
Cryptosystem Based Algorithms. IJCSMC , Vol. 2, Issue.
7, pg.146 – 151.
1.2
1
0.8
0.6
0.4
0.2
0
Encryption
Time
text text text text text
1
3
5
7
9
Decryption
Time
Text Data
Figure 5: Time required for Encryption and
Decryption
7. CONCLUSION
In this paper we have implemented the Data
Encryption Standard (DES) algorithm using MATLAB
R2011B for different texts of increasing sizes, keeping key
constant and it is observed that the time for encryption and
decryption increases as the file size increases. Also the time
required for encryption is less than the time required for
decryption.
REFERENCES
[1] Sharma, G., & Kakkar, A. (June-2012). Cryptography
Algorithms and approaches used for data security. IJSER
Volume 3, Issue 6,.
[2] Bhat, B., Ali, A. W., & Gupta, A. (2015). DES and AES
Performance Evaluation. ICCCA , 887-890.
[3] Schneier, B. Applied Cryptography.
[4] Thakur, J., & Kumar, N. (December 2011). DES, AES and
Download