You are on page 1of 13

\documentclass[12pt,a4paper]{article}

\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage[none]{hyphenat}
\begin{document}
\begin{center}
\begin{huge}
A
\\
PROJECT BASED LAB REPORT ON
\\
\end{huge}
\end{center}
\begin{center}
\begin{huge}
BLOCK CIPHER DES DECRYPTION 64-BIT
\end{huge}
\end{center}
\begin{center}
\begin{large}
submitted in the partial fulfilment of the requirements for the award of the
degree of Bachelor of Technology In Computer Science and Engineering
\end{large}
\end{center}

K.SHIKHA
(14003563)
\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:
T.CHAITANYA
(14003779)

\begin{center}
\includegraphics[scale=0.7]{10.jpg}
\end{center}
\begin{center}
\begin{large}
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
\end{large}
\end{center}
\begin{center}
\begin{huge}
K L University
\end{huge}
\end{center}
\begin{center}
Green Fields,Vaddeswaram,Guntur District
\\
2016-2017
\end{center}
\newpage
\begin{center}
\begin{huge}
K L University
\end{huge}
\end{center}
\begin{center}
\begin{large}
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
\end{large}
\end{center}
\begin{center}
\includegraphics[scale=0.7]{10.jpg}
\end{center}
\begin{center}
\begin{large}
CERTIFICATE
\end{large}
\end{center}
This is to certify that this project based lab report "modified DES cipher
(decryption)" is a bonafide work done by K.SHIKHA(14003563),in partial
fulfilment of the requirement for the award of degree in BACHELOR OF
TECHNOLOGY in computer science and engineering during the academic year
$2016-2017.$
\begin{large}
\\
\\
\\
\\
\\

Lecture Incharge \: \: \: \: \: \: \: \: \: \: \: \: \: \: \: \: Head Of The


Department
\end{large}
\newpage
\begin{center}
\begin{huge}
K L University
\end{huge}
\end{center}
\begin{center}
\begin{large}
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
\end{large}
\end{center}
\begin{center}
\includegraphics[scale=0.75]{10.jpg}
\end{center}
\begin{center}
\begin{large}
DECLARATION
\end{large}
\end{center}
We hereby declare that this project based lab report entitled"BLOCK CIPHER
DES DECRYPTION 64-BIT"has been prepared by us in the partial fulfilment of the
requirement for the award of degree"BACHELOR OF TECHNOLOGY IN COMPUTER
SCIENCEAND ENGINEERING"during the academic year 2016-2017.
\\ We declare that this project based lab report is of our own report and it
has not been submitted to any other university for the award of any degree.
\\
\\
\\
\\
\begin{flushright}
K.SHIKHA(14003563)
\\ T.CHAITANYA(14003779 )
\end{flushright}
\newpage
\begin{center}
\begin{huge}ACKNOWLEDGEMENTS\end{huge}
\end{center}

My sincere thanks to Mr.E.SURESH BABU ,in the lab for the outstanding support
throughout the project for the successfull completion of the work.
\\
\\We express our gratitude to Dr.V.SRIKANTH,head of the department for
computer science and engineering for providing us with adequate facilites,
ways,and means by which we are able to complete this project work.
\\
\\ We would like to place on record the deep sense of gratitude to the
Honourable Vice Chancellor,K L University for providing the necessary
facilites to carry the concluded project work.
\\
\\ Last but not the least ,we thank all the Teaching and Non teaching staff
of our department and especially our class mates and friends for their support
in the completion of the project work.
\\
\\
\\
\\
\\
\\
\\
\\
\begin{flushright}
K.SHIKHA(14003563)
\\ T. CHAITANYA(14003779 )
\end{flushright}
\newpage
\begin{center}
\begin{huge}
ABSTRACT
\end{huge}
\end{center}
The princple goal guiding the design of any encryption algorithm must be
security against unauthorized attacks.Within the last decade,there has been a
vast increase in the accumulation and communication of digital computer data
in both the private and public sectors.much of these information has a
significant value ,either directly and indirectly,which requires
protection.The algorithms uniquely define the mathematical steps required to
transform the data into cryptographic cipher and also to transform the cipher
back to the original form.performance and security level is the main
charactristics that differentiate the one encryption algorithm from
another.Here introduces a another method to enhance the performance of the DES
algorithm is used here.This is done by replacing the predefined XOR operation
applied during the 16 round of standard algorithm by new operation depends on
using the two keys,each key consists of combination of four stages(0,1,2,3)
instead of ordinary 2 state key(0,1).This replacement adds a new level of
protection strength and more robustness against breaking methods.
\newpage
\begin{tabular}{||c||c|c||}
\hline
S NO & CONTENTS & PAGE NO \\
\hline
1 & Introduction & 6-7 \\
\hline
2 &Project Descrption & 8-9 \\
\hline
3 &Des Decryption & 10 \\
\hline

4 &Initial And Permutation & 14 \\


\hline
5 & Round Function &15 \\
\hline
6 & Key Generation & 16 \\
\hline
7 & Conclusion & 19 \\
\hline
8 & References & 20 \\
\hline
\end{tabular}

\newpage
\begin{center}
\begin{huge}1.INTRODUCTION\end{huge}
\end{center}
The data encryption standard is a symmetric key algorithm for encryption key
of electronic data.Although now consider insecure,it was highly influential in
advancement of modern cryptography.There are two main types of cryptography in
using two-symmetric or secret key cryptography or asymmetric cryptography or
public key cryptography.symmetric key cryptography is the oldest type where as
asymmetric cryptography is only begin used publicly.Asymmetric cryptography
was a major milestone in the search for the perfect encryption scheme.It
involves
the use of one key which is used for both encryption and decryption hence the
use of symmetric.
It is necessary for security purposes that the secret key never be
revealed.Developed in the early IBM and based on an earlier design by Horst
Feistel, the algorithm was submitted to the National Bureau of Standards (NBS)
following the agency's invitation to propose a candidate for the protection of
sensitive, unclassified electronic government data. In 1976, after
consultation with the National Security Agency (NSA), the NBS eventually
selected a slightly modified version (strengthened against differential
cryptanalysis, but weakened against brute force attacks), which was published
as an official Federal Information Processing Standard (FIPS) for the United
States .The publication of an NSA-approved encryption standard simultaneously
resulted in its quick international adoption and widespread academic scrutiny.
Controversies arose out of classified design elements, a relatively short key
length of the symmetric-key block cipher design, and the involvement of the
NSA, nourishing suspicions about a back door. The intense academic scrutiny
the algorithm received over time led to the modern understanding of block
ciphers and their cryptanalysis. Des is now consider to be insecure for many
applications.Another member of the DES team, Walter Tuchman, stated "We
developed the DES algorithm entirely within IBM using IBMers. The NSA did not
dictate a single wire In contrast, a declassified NSA book on cryptologic
history states:
In NBS solicited private industry for a data encryption standard (DES). The
first offerings were disappointing, so NSA began working on its own algorithm.
Then Howard Rosenblum, deputy director for research and engineering,
discovered that Walter man of IBM was working on a modification to Lucifer for
general use.It gave man a clearance and brought him in to work jointly with
the Agency on his Lucifer modification.".
DES has been withdrawn as a standard by the national
institue of standards and technology. some documentation makes a distinction
between DES as a standard and DES as algorithm,referring to the algorithm as
the DEA(DATA ENCRYPTION ALGORITHM).The DES can be said to have "jump started"
the nonmilitary study and development of encryption algorithms. In the 1970s
there were very few cryptographers, except for those in military or
intelligence organizations, and little academic study of cryptography. There
are now many active academic cryptologists, mathematics departments with
strong programs in cryptography, and commercial information security companies
and consultants. A generation of cryptanalysts has cut its teeth analyzing
(that is trying to "crack") the DES algorithm. In the words of cryptographer
Bruce Schneier,[17] "DES did more to galvanize the field of cryptanalysis than
anything else. Now there was an algorithm to study." An astonishing share of
the open literature in cryptography in the 1970s and 1980s dealt with the DES,
and the DES is the standard against which every symmetric key algorithm since
has been compared.[18].The introduction of DES is considered to have been a
catalyst for the academic study of cryptography, particularly of methods to
crack block ciphers. According to a NIST retrospective about DES.On 17 March
1975, the proposed DES was published in the Federal Register. Public comments
were requested, and in the following year two open workshops were held to
discuss the proposed standard. There was some criticism from various parties,
including from public-key cryptography pioneers Martin Hellman and Whitfield
Diffie,[2] citing a shortened key length and the mysterious "S-boxes" as
evidence of improper interference from the NSA. The suspicion was that the
algorithm had been covertly weakened by the intelligence agency so that they
but no-one elsecould easily read encrypted messages.[3] Alan Konheim (one of
the designers of DES) commented, "We sent the S-boxes off to Washington. They
came back and were all different."[4] The United States Senate Select
Committee on Intelligence reviewed the NSA's actions to determine whether
there had been any improper involvement. In the unclassified summary of their
findings, published in 1978, the Committee wrote:
In the development of DES, NSA convinced IBM that a reduced key size was
sufficient; indirectly assisted in the development of the S-box structures;
and certified that the final DES algorithm was, to the best of their
knowledge, free from any statistical or mathematical weakness.
\newpage

\begin{huge}
\begin{center}
Introduction
\end{center}
\end{huge}

\paragraph*{}

There are two main types of cryptography in using today -


symmetric or secret key cryptography and asymmetric or public key
cryptography. Symmetric key cryptography is the oldest type whereas asymmetric
cryptography is only being used publicly since the late 1970s. Asymmetric
cryptography was a major milestone in the search for a perfect encryption
scheme. Secret key cryptography goes back to at least Egyptian times and is of
concern here. It involves the use of only one key which is used for both
encryption and decryption hence the use of the term symmetric. Figure below
depicts this idea. It is necessary for security purposes that the secret key
never be revealed.To accomplish encryption, most secret key algorithms use two
main techniques known as substitution and permutation. Substitution is simply
a mapping of one value to another whereas permutation is a reordering of the
bit positions for each of the inputs. These techniques are used a number of
times in iterations called rounds. Generally, the more rounds there are, the
more secure the algorithm. A non-linearity is also introduced into the
encryption so that decryption will be computationally infeasible without the
secret key. This is achieved with the use of S-boxes which are basically non-
linear substitution tables where either the output is smaller than the input
or vice versa
One of the main problems with secret key cryptography is key distribution. For
this form of cryptography to work, both parties must have a copy of the secret
key. This would have to be communicated over some secure channel which,
unfortunately, is not that easy to achieve. As will be seen later, public key
cryptography provides a solution to this.
\begin{center}
2. PROJECT DESCRIPTION

\end{center}
\begin{flushleft}
2.1 DES- data encryption standard
\end{flushleft}

\paragraph*{}
The Data Encryption Standard is a block cipher, meaning a cryptographic key
and algorithm are applied to a block of data simultaneously rather than one
bit at a time. To encrypt a plaintext message, DES groups it into 64-bit
blocks. DES works by using the same key to encrypt and decrypt a message, so
both the sender and the receiver must know and use the same private key and
hence it is a symmetric block cipher.
DES algorithm takes a fixed-length string of plaintext bits and transforms it
through a series of complicated operations into another cipher text bit string
of the same length. In the case of DES, the block size is 64 bits. DES also
uses a key to customize the transformation, so that decryption can supposedly
only be performed by those who know the particular key used to encrypt. The
key consists of 64 bits. However, only 56 of these are actually used by the
algorithm. Eight bits are used for checking parity, and are thereafter
discarded. Hence the effective key length is 56 bits
\begin{flushleft}
\begin{large}
2.2 working of des
\end{large}
\end{flushleft}
\paragraph*{}
DES is based on a cipher known as the Feistel block cipher. This was a block
cipher developed by the IBM cryptography researcher Horst Feistel in the early
70s. It consists of a number of rounds where each round contains bit-
shuffling, non-linear substitutions or S-boxes and exclusive OR operations.
Most symmetric encryption schemes today are based on this structure known as a
feistel network.As with most encryption schemes, DES expects two inputs - the
plaintext to be encrypted and the secret key. The manner in which the
plaintext is accepted, and the key arrangement used for encryption and
decryption, both determine the type of cipher it is. DES is therefore a
symmetric, 64 bit block cipher as it uses the same key for both encryption and
decryption and only operates on 64 bit blocks of data at a time be they
plaintext or cipher text. The key size used is 56 bits, however a 64 bit or
eight-byte key is actually input. The least significant bit of each byte is
either used for parity (odd for DES) or set arbitrarily and does not increase
the security in any way. All blocks are numbered from left to right which
makes the eight bit of each byte the parity bit. Once a plain-text message is
received to be encrypted, it is arranged into 64 bit blocks required for
input. If the number of bits in the message is not evenly divisible by 64,
then the last block will be padded. Multiple permutations and substitutions
are incorporated throughout in order to increase the difficulty of performing
a cryptanalysis on the cipher.
\begin{flushleft}
\begin{large}
2.3 Overall structure
\end{large}
\end{flushleft}
\paragraph*{}
Figure below shows the sequence of events that occur during an encryption
operation. DES performs an initial permutation on the entire 64 bit block of
data. It is then split into 2, 32 bit sub-blocks, Li and Ri which are then
passed into what is known as a round, of which there are 16 rounds in DES.
Each of the rounds are identical and the effects of increasing their number is
two fold - the algorithms security is increased and its temporal efficiency
decreased. Clearly these are two conflicting outcomes and a compromise must be
made. For DES the number chosen was 16, probably to guarantee the elimination
of any correlation between the cipher text and either the plaintext or key. At
the end of the 16th round, the 32 bit Li and Ri output quantities are swapped
to create what is known as the pre-output. This [R16, L16] concatenation is
permuted using a function which is the exact inverse of the initial
permutation. The output of this final permutation is the 64 bit cipher text.
\begin{flushleft}
\begin{large}
2.4 Details of individual rounds:
\end{large}
\end{flushleft}
\paragraph*{}
Details of an individual round can be seen in figure below. The main
operations on the data are encompassed into what is referred to as the cipher
function . This function accepts two different length inputs of 32 bits and 48
bits and outputs a single 32 bit number. Both the data and key are operated on
in parallel, however the operations are quite different. The 56 bit key is
split into two 28 bit halves Ci and Di (C and D being chosen so as not to be
confused with L and R). The value of the key used in any round is simply a
left cyclic shift and a permuted contraction of that used in the previous
round. Mathematically, this can also be written where Lcsi is the left cyclic
shift for round i, $C_i$ and $D_i$ are the outputs after the shifts, PC2 is a
function which permutes and compresses a 56 bit number into a 48 bit number
and $K_i$ is the actual key used in round i. The number of shifts is either
one or two and is determined by the round number i. For i = {1, 2, 9, 16} the
number of shifts is one and for every other round it is two .The common
formulas used to describe the relationships between the input to one round and
its output or the input to the next round are:
$$Li = Ri1 (2.3)
Ri = Li1 F(Ri1, Ki) (2.4)$$
where L and R have their usual meaning and F is the cipher function. This
function F is the main part of every round and consists of four separate
stages .
1. The E-box expansion permutation - here the 32-bit input data from Ri1 is
expanded and permuted to give the 48 bits necessary for combination with the
48 bit key. The E-box expansion permutation delivers a larger output by
splitting its input into 8, 4-bit blocks and copying every first and fourth
bit in each block into the output in a defined manner. The security offered by
this operation comes from one bit affecting two substitutions in the S-boxes.
2. The bit by bit addition modulo 2 or exclusive OR of the E-box output and 48
bit sub key $K_i$
3. The S-box substitution - this is a highly important substitution which
accepts a 48-bit input and outputs a 32-bit number. The S-boxes are the only
non-linear operation in DES and are therefore the most important part of its
security. They were very carefully designed although the conditions they were
designed under has been under intense scrutiny since DES was released. The
input to the S-boxes is 48 bits long arranged into 8, 6 bit blocks (b1,
b2, . . . , b6). There are 8 S-boxes (S1, S2, . . . , S8) each of which
accepts one of the 6 bit blocks. The output of each S-box is a four bit
number. Each of the S-boxes can be thought of as a 4 16 matrix. Each cell of
the matrix is identified by a coordinate pair (i, j). The value of i is taken
as the decimal representation of the first and last bits of the input to each
S-box, Each cell within the S-box matrices contains a 4-bit number which is
output once that particular cell is selected by the input.
4. The P-box permutation - This simply permutes the output of the S-box
without changing the size of the data (defined in table 2.1). It is simply a
permutation and nothing else. It has a one to one mapping of its input to its
output giving a 32 bit output from a 32 bit input.
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\\
\begin{center}
\begin{huge}
3. MODULES DESCRIPTION AND WORKING
\end{huge}
\end{center}
\begin{flushleft}
\begin{Large}
3.1 MODULES DESCRIPTION AND WORKING
\end{Large}
\end{flushleft}
\paragraph*{}
Task 1: Defining Initial Permutation and Inverse IP functions
There are two inputs to the DES, one is the plaintext and the other is the
64bit key. The plaintext is divided into blocks by the multiples of 64. If the
last block plaintext is not of size 64 bit then it is filled with zeros. The
plaintext is then permutated which is known as rearranging of bits. The size
of the plaintext is not changed but the plaintext is rearranged. The initial
and final inverse initial permutation does not increase any security to that
message or plaintext, but makes the implementation easier in some contexts. It
is made for making hardware circuit part easier. The figure below is the
standard initial permutation table which is applied before encrypting the
plaintext. The 58th bit of the plaintext is taken as 1st bit, the 50th bit of
plaintext is taken as 2nd bit and the 7th bit of plaintext is taken as last
bit. Thus the plaintext is rearranged by using the initial permutation table.
\\
\\
Task 2: Defining Expansion and Permutation function
The result of the initial permutation 64bit is divided into two 32bit blocks
Li and the Ri. The right half 32bits Ri is taken and expanded to 48bit and is
rearranged which means permutated by using the expansion and permutated table.
\\
\\
Task 3: Defining S-Box Function
Each S-box replaces a 6-bit input with a 4-bit output. Given a 6-bit input,
the 4-bit output is found by selecting the row using the outer two bits, and
the column using the inner four bits. For example, an input "011011" has outer
bits "01" and inner bits "1101"; noting that the first row is "00" and the
first column is "0000", the corresponding output for S-box S5 would be "1001"
(=9), the value in the second row, 14th column.
\\
\\
Task 4: Defining PC-1 and PC-2

The 56-bit key used by DES is, when in standard format, stored in eight bytes,
in which the least significant bit of each byte is used for parity. Thus, the
permutation, called Permuted Choice 1, which divides the 56-bit key into two
28-bit halves, acts on bits 1 through 7, 9 through 15, 17 through 23, and so
on. The figure below shows the table for permutated choice 1.
\\
\\
The divided two 28bit halves $C_k$ and $D_k$ are now permutated by using the
permutated choice2 for getting the sub keys. The permutated choice 2 is
applied 16 times so that 16 different sub keys are generated for the 16 rounds
in DES. The 56bit key generated from the permutated choice1 is now reduced to
the 48bit 16 sub keys $K_i$ where i represent the sub key number.
\\
\\
Task 5: Defining Shift Key function
After permutated choice1 the resulted $C_k$ and $D_k$ values are circularly
shifted 16 times for getting the sub keys of size 56bit each. By applying the
circular shift twice we will get the 16 sub keys C0 D0 to C15 D15. The
resulted $C_k$ and $D_k$ values are processed with permutated choice2 for
getting the 48 bit sub keys Ki.
\\
\\
Task 6: Defining Initial Key and Plain text input of 64- bits
The initial key and the input plaintext size is for the DES is given as 64
bits, so the 64bit plaintext is taken as one block and the initial vector of
64 bit is XOR with the 64bit block plain text. The plaintext is 64bit so there
is no need for padding zeros.
\\
\\
Task 7: Defining the other constant functions require for DES implementation
All the required constant functions that are required for DES have been
successfully defined.
\begin{flushleft}
\begin{large}
3.2 Key generation phase
\end{large}
\end{flushleft}

\paragraph*{}

The key generation phase in DES for encryption is the algorithm which
generates the sub keys. Initially, the 64 bit input is taken as the key and
then 56 bits of the key are selected from the initial 64bit input by Permuted
Choice 1 (PC-1). The remaining eight bits are either discarded or used as
parity check bits. The 56 bits are then divided into two 28-bit halves $C_k$
and $D_k$ each half is there after treated separately. In successive rounds,
both halves are rotated left by one and two bits (specified for each round)
called Circular shift operation. Therefore 16 sub keys are generated of size
56bit and then 48 sub key bits are selected by Permuted Choice 2 (PC-2), the
24 bits from the left half and the 24bits from the right. The rotations
(denoted by "<<<" in the diagram) mean that a different set of bits is used in
each sub key, each bit is used in approximately 14 out of the 16 sub keys. The
key schedule for decryption is similar; the sub keys are in reverse order
compared to encryption. Apart from that change, the process is the same as for
encryption. The same 28 bits are passed to all rotation boxes.
The 64-bit key is permuted according to the following table, PC-1. Since the
first entry in the table is "57", this means that the 57th bit of the original
key K becomes the first bit of the permuted key K+. The 49th bit of the
original key becomes the second bit of the permuted key. The 4th bit of the
original key is the last bit of the permuted key. Note only 56 bits of the
original key appear in the permuted key.

PC-1

57 49 41 33 25 17 9 \\
1 58 50 42 34 26 18 \\
10 2 59 51 43 35 27 \\
19 11 3 60 52 44 36 \\
63 55 47 39 31 23 15 \\
7 62 54 46 38 30 22 \\
14 6 61 53 45 37 21 \\
21 13 5 28 20 12 4
\\ Example: From the original 64-bit key
\\K = 00010011 00110100 01010111 01111001 10011011 10111100 11011111 11110001
\\ we get the 56-bit permutation
\\ K+ = 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111
Next, split this key into left and right halves, C0 and D0, where each half
has 28 bits.
\\ Example: From the permuted key K+, we get
\\ C0 = 1111000 0110011 0010101 0101111
\\ D0 = 0101010 1011001 1001111 0001111
\\ With C0 and D0 defined, we now create sixteen blocks $C_n$ and $D_n$,
1<=n<=16. Each pair of blocks $C_n$ and $D_n$ is formed from the previous pair
$C_n-1$ and $D_n-1$, respectively, for n = 1, 2... 16, using the following
schedule of "left shifts" of the previous block. To do a left shift, move each
bit one place to the left, except for the first bit, which is cycled to the
end of the block.
\\ Iteration Number of
\\ Number Left Shifts

1 1\\
2 1\\
3 2\\
4 2\\
5 2\\
6 2\\
7 2\\
8 2\\
9 1\\
10 2\\
11 2\\
12 2\\
13 2\\
14 2\\
15 2\\
16 1\\
\\
This means, for example, C3 and D3 are obtained from C2 and D2, respectively,
by two left shifts, and C16 and D16 are obtained from C15 and D15,
respectively, by one left shift. In all cases, by a single left shift is meant
a rotation of the bits one place to the left, so that after one left shift the
bits in the 28 positions are the bits that were previously in positions 2,
3,..., 28, 1.
\\Example: From original pair C0 and D0 we obtain:\\
C0 =1111000011001100101010101111\\
D0 = 0101010101100110011110001111\\
C1 = 1110000110011001010101011111\\
D1 = 1010101011001100111100011110\\
C2 = 1100001100110010101010111111\\
D2 = 0101010110011001111000111101\\
C3 = 0000110011001010101011111111\\
D3 = 0101011001100111100011110101\\
C4 = 0011001100101010101111111100\\
D4 = 0101100110011110001111010101\\
C5 = 1100110010101010111111110000\\
D5 = 0110011001111000111101010101\\
C6 = 0011001010101011111111000011\\
D6 = 1001100111100011110101010101\\
C7 = 1100101010101111111100001100\\
D7 = 0110011110001111010101010110\\
C8 = 0010101010111111110000110011\\
D8 = 1001111000111101010101011001\\
C9 = 0101010101111111100001100110\\
D9 = 0011110001111010101010110011\\
C10 = 0101010111111110000110011001\\
D10 = 1111000111101010101011001100\\
C11 = 0101011111111000011001100101\\
D11 = 1100011110101010101100110011\\
C12 = 0101111111100001100110010101\\
D12 = 0001111010101010110011001111\\
C13 = 0111111110000110011001010101\\
D13 = 0111101010101011001100111100\\
C14 = 1111111000011001100101010101\\
D14 = 1110101010101100110011110001\\
C15 = 1111100001100110010101010111\\
D15 = 1010101010110011001111000111\\
C16 = 1111000011001100101010101111\\
D16 = 0101010101100110011110001111\\
\\We now form the keys $K_n$, for 1<=n<=16, by applying the following
permutation table to each of the concatenated pairs $C_n$ $D_n$. Each pair has
56 bits, but PC-2 only uses 48 of these.\\
\\
\\
\\
\\
\\
\\
\\
\\ \begin{flushleft}
\begin{Huge}
$pc-2$
\end{Huge}
\end{flushleft}

\begin{flushleft}

14 17 11 24 1 5 \\
3 28 15 6 21 10\\
23 19 12 4 26 8\\
16 7 27 20 13 2\\
41 52 31 37 47 55\\
30 40 51 45 33 48\\
44 49 39 56 34 53\\
46 42 50 36 29 32\\
\end{flushleft}
Therefore, the first bit of $K_n$ is the 14th bit of $C_n$ $D_n$, the second
bit the 17th, and so on, ending with the 48th bit of Kn being the 32th bit of
$C_n$ $D_n$. \\
Example: For the first key we have \\ C1D1 = 1110000 1100110 0101010 1011111
1010101 0110011 0011110 0011110 \\ after we apply the permutation PC-2,
becomes \\
\\
K1 = 000110 110000 001011 101111 111111 000111 000001 110010\\

For the other keys we have\\


K2 = 011110 011010 111011 011001 110110 111100 100111 100101\\
K3 = 010101 011111 110010 001010 010000 101100 111110 011001\\
K4 = 011100 101010 110111 010110 110110 110011 010100 011101\\
K5 = 011111 001110 110000 000111 111010 110101 001110 101000\\
K6 = 011000 111010 010100 111110 010100 000111 101100 101111\\
K7 = 111011 001000 010010 110111 111101 100001 100010 11110\\
K8 = 111101 111000 101000 111010 110000 010011 101111 111011\\
K9 = 111000 001101 101111 101011 111011 011110 011110 000001\\
K10 = 101100 011111 001101 000111 101110 100100 011001 001111\\
K11 = 001000 010101 111111 010011 110111 101101 001110 000110\\
K12 = 011101 010111 000111 110101 100101 000110 011111 10100\\
K13 = 100101 111100 010111 010001 111110 101011 101001 000001\\
K14 = 010111 110100 001110 110111 111100 101110 011100 111010\\
K15 = 101111 111001 000110 001101 001111 010011 111100 001010 \\
K16 = 110010 110011 110110 001011 000011
100001 011111 110101 \\
Now the 16 sub keys of size 48 bit are generated by using the permutated
choice2.
\begin{flushleft}
\begin{huge}

3.3 Decryption

\end{huge}
\end{flushleft}
\paragraph*{}
Decryption is simply the inverse of encryption, following the same steps as
above, but reversing the order in which the sub keys are applied.

\end{document}

You might also like