Cryptography Week4 Assessment: KEY: 0123456789ABCDEF Input Data: Hi Hello Welcome

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

CRYPTOGRAPHY WEEK4 ASSESSMENT

1. Use DES Online IDE Calculator and perform the operation for DES
KEY: 0123456789ABCDEF

INPUT DATA: HI HELLO WELCOME


2.Explain about Block,Stream and Feistal Cipher

BLOCK CIPHER:
Block cipher is an encryption algorithm which takes fixed size of input
say b bits and produces a cipher text of b bits again. If input is larger than b bits
it can be divided further. For different applications and uses, there are several
modes of operations for a block cipher.

Electronic Code Book (ECB) –

Electronic code book is the easiest block cipher mode of functioning. It is easier
because of direct encryption of each block of input plaintext and output is in
form of blocks of encrypted cipher text. Generally, if a message is larger
than b bits in size, it can be broken down into bunch of blocks and the
procedure is repeated.
Advantages of using ECB –
 Parallel encryption of blocks of bits is possible, thus it is a faster way of
encryption.
 Simple way of block cipher.
Disadvantages of using ECB –
 Prone to cryptanalysis since there is a direct relationship between
plaintext and ciphertext.
Cipher Block Chaining –

Cipher block chaining or CBC is an advancement made on ECB since ECB


compromises some security requirements. In CBC, previous cipher block is
given as input to next encryption algorithm after XOR with original plaintext
block. In a nutshell here, a cipher block is produced by encrypting a XOR
output of previous cipher block and present plaintext block.

Advantages of CBC –
 CBC works well for input greater than b bits.
 CBC is a good authentication mechanism.
 Better resistive nature towards cryptanalsis than ECB.
Disadvantages of CBC –
 Parallel encryption is not possible since every encryption requires
previous cipher.
STREAM CIPHER
Stream ciphers are good for fast implementations with low resource
consumption. These two features help the defender implement resistance
strategies in devices that may not have the resources for a block
cipher implementation. Stream ciphers are also useful for encrypting wireless
signals, which more naturally fit a streaming model than transmitting data in
larger, fixed-size chunks. For example, the A5/1 stream cipher is used in GSM
phones and the RC4 stream cipher has been used in the security system for
wireless local area networks (WLANs).

The simplicity of stream ciphers is both a blessing and a curse. It appears to be


more difficult to adequately include stream ciphers in cryptosystems. For
example, the implementation of RC4 in Wired Equivalent Privacy (WEP) for
WLAN security was a failure, even though the RC4 cipher itself was not broken
—it was just implemented badly . Specifically, the implementation artificially
shortened the key period; the technical reason this is a problem will be
explained shortly.
Stream ciphers can be broadly classified into those that work better in hardware
and those that work better in software. A5/1 is an example of a cipher better
suited to hardware. It is one of a class of algorithms called linear feedback shift
registers (LFSRs), which are easy to construct with a little electrical engineering
knowledge. RC4 is an example of a cipher suited for software, but optimized for
low resource usage. It only requires less than 1 kilobyte of memory and simple
array-based operations.
Stream ciphers use conceptual tools similar to block ciphers. Substitution is the
primary tool: each bit or byte of plaintext is combined with the key material by
an exclusive-or (XOR) operation to substitute the plaintext bit into the cipher
text bit. Binary XOR is quite simple. There are only two possible values, 1 or 0,
and if the two inputs are the same the result is 0, otherwise it is 1.
Since stream ciphers cannot do transposition per se, as the cipher cannot cache
one block of input and transpose the contents, successful stream ciphers create a
feedback system where current key material depends on the previous operation
of the system. Therefore, one rather short key can initialize the system to
produce a pseudorandom stream of key material that does not repeat for quite a
long time. Due to the XOR operation, once a stretch of key material has been
used it can never be used again. This is a common mistake in stream cipher
implementation, and was one implementation error in WEP.
This attack is possible because the XOR operation is its own inverse. Any
number+2−2 equals itself because addition and subtraction are inverses.
Likewise, combining two cipher texts encrypted with the same key eliminates
the key, since it is XOR’d with itself. In this case, when the key is eliminated
the two plaintexts remain. They are still XOR’d together, but from this
information, statistical methods like those used to defeat the mono-alphabetic
substitution cipher, described earlier, can be used to recover each plaintext
without much difficulty.

FEISTEL CIPHER
Feistel Cipher model is a structure or a design used to develop many block
ciphers such as DES. Feistel cipher may have invertible, non-invertible and self-
invertible components in its design. Same encryption as well as decryption
algorithm is used. A separate key is used for each round. However same round
keys are used for encryption as well as decryption.
Feistel cipher algorithm
 Create a list of all the Plain Text characters.
 Convert the Plain Text to Ascii and then 8-bit binary format.
 Divide the binary Plain Text string into two halves: left half (L1)and right
half (R1)
 Generate a random binary keys (K1 and K2) of length equal to the half
the length of the Plain Text for the two rounds.
First Round of Encryption
a. Generate function f1 using R1 and K1 as follows:
f1= xor(R1, K1)
b. Now the new left half(L2) and right half(R2) after round 1 are as follows:
R2= xor(f1, L1) L2=R1
Second Round of Encryption
a. Generate function f2 using R2 and K2 as follows:
f2= xor(R2, K2)
b. Now the new left half(L2) and right half(R2) after round 1 are as follows:
R3= xor(f2, L2) L3=R2
Concatenation of R3 to L3 is the Cipher Text
Same algorithm is used for decryption to retrieve the Plain Text from the Cipher
Text.
Examples:
Plain Text is: Hello
Cipher Text: E1!w(
Retrieved Plain Text is: b'Hello'

Plain Text is: Geeks


Cipher Text: O;Q
Retrieved Plain Text is: b'Geeks'

You might also like