Mod 2 Notes Crypto
Mod 2 Notes Crypto
Mod 2 Notes Crypto
CRYPTOGRAPHY
17EC744
CBCS SCHEME
MODULE - 2
Classical Encryption Techniques: Symmetric cipher model, Substitution
techniques, Transposition techniques, Stegnography (Text 1: Chapter 1)
SYMMETRIC CIPHERS: Traditional Block Cipher structure, Data Encryption
Standard (DES) (Text 1: Chapter 2: Section1, 2)
MODULE - 3
SYMMETRIC CIPHERS: The AES Cipher. (Text 1: Chapter 4: Section 2, 3, 4)
Pseudo-Random-Sequence Generators and Stream Ciphers: Linear
Congruential Generators, Linear Feedback Shift Registers, Design and
analysis of stream ciphers, Stream ciphers using LFSRs (Text 2: Chapter 16:
Section 1, 2, 3, 4)
MODULE – 4
More number theory: Prime Numbers, Fermat‘s and Euler‘s theorem,
Primality testing, Chinese Remainder theorem, discrete logarithm.
(Text 1: Chapter 7)
Principles of Public-Key Cryptosystems: The RSA algorithm, Diffie -
Hellman Key Exchange, Elliptic Curve Arithmetic, Elliptic Curve
Cryptography (Text 1: Chapter 8, Chapter 9: Section 1, 3, 4)
MODULE – 5
Data integrity. This property refers to data that has not been
changed, destroyed, or lost in an unauthorized or accidental
manner. The need for data integrity is especially evident if data is
transmitted across a nonsecure network, such as the Internet, where
a man-in-the-middle attack can easily be mounted. Integrity is
enforced by mathematical functions applied to the message being
transmitted.
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Here, The matrix is filled by letter of Keyword from left to right
and from top to bottom.
Remainder of matrix is filled with alphabets randomly but in
alphabetic order.
I & J letters count as one letter.
Repeating plain text letters that would fall in same pair are
separated with a filler letter. Ex : ‘x’ in Balloon, Cool, School, etc..
Here 26x26 = 676 diagrams so identification of individual
diagrams is more difficult.
The relative frequency of individual letters has more range than
that of diagrams making frequency analysis is much more
difficult.
It was used in WW-I & WW-II by British Army & USA.
It is relatively easy to break. Because it still leaves much of the
structure of plain text language.
Note : In any given Book of a given page, Total number of
occurrence of each letter in text divided by number of occurrence
of letter ‘e’ ( most frequently used letter)
For example : using the Playfair cipher diagram, write the cipher
diagram /table for the given PT :-
ENGLISH
ENGINEERING
ELECTRONICS
TECHNOLOGY
SAMBHRAM
CRYPTOGRAPHY
HILL CIPHER :
It is developed by Lester Hill in 1929. This encryption algorithm takes
‘m’ successive Plain Text letters & substitutes for them ‘m’ cipher text
letters.
Here, each cipher text is a numerical value a=0,b=1,……z=25).
Here mathematical representation & calculation is in such a way that,
the encryption key is a 3X3 matrix ―› ( K )
Decryption key is a 3 X 3 matrix ―› ( K-1 )
Wherein K. K-1 = K-1. K = I = Identity matrix ,which is square matrix.
a b c d e f g h i j k l mn o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
Then simplifying the equation for each 3 letter combination with key
matrix :
For ‘pay ’
Then, for each PT refer the respective letter at column, then refer
the key letter at respective row…the junction of both PT & Key is
the letter as CT., here for “ch” the CT is “ J ”.
PROBLEMS:
Using the Vigenere Ciphering method, find the Cipher Text
for the given Plain Text by taking Key K as “ karnataka ”.
electronics and Communication
technological university
government of karnataka
cryptography and security
royal challengers bangalore
TRANSPOSITION TECHNIQUE :
Here we perform permutation on Plain Text Letters.
Here, three methods are used :-
1. Common method used is – RAIL FENCE TECHNIQUE.
Here,the plain text is written down as a sequence of diagonals and then read
off as a sequence of rows/.
For example : Plain Text is – Sambhram Institute of Technology , Then by
this method;
s m h a i
a b r m n
s i u e f
t t t o t
e h O o y
c n l g
Then considering the complete first row characters and then second row
characters and writing in a single line will become CT for the given PT.
CT = SMHAISIUEFEHLGABRMNTTTOTCNOY
2. Second Method :
3. Third Method :
STEGNOGRAPHY :
Steganography is the practice of concealing a file, message, image, or video within another
file, message, image, or video. The word steganography comes from Greek steganographia,
which combines the words steganós, meaning "covered or concealed", and -graphia
meaning "writing".
The oldest documented case of steganography dates to 500 BC, in which Histiaeus, the
ruler of Milteus, tattooed a message on the shaved head of one of his slaves and let the hair
grow back. He then sent the slave to the Aristagoras, his son-in-law, who shaved the slave’s
head again and revealed the message.
Steganography, the practice of hiding information, has been around for centuries. And in
parallel to technological advances, steganography has also evolved and adapted with the
advent of computers and the internet.
Digital steganography usually involves hiding data inside innocuous files such as images,
videos, and audio.
Today, digital steganography is one of the important components in the toolboxes of spies
and malicious hackers, as well as human rights activists and political dissidents.
Steganography works by hiding information in a way that doesn’t arouse suspicion. One of
the most popular techniques is 'least significant bit (LSB) steganography. In this type of
steganography, the information hider embeds the secret information in the least significant
bits of a media file.
For instance, in an image file each pixel is comprised of three bytes of data corresponding
to the colors red, green, and blue (some image formats allocate an additional fourth byte to
transparency, or ‘alpha’).
LSB steganography changes the last bit of each of those bytes to hide one bit of data. So, to
hide one megabyte of data using this method, you’ll need an eight-megabyte image file.
Since modifying the last bit of the pixel value doesn’t result in a visually perceptible change
to the picture, a person viewing the original and the steganographically modified images
won’t be able to tell the difference.
The same scheme can be applied to other digital media (audio and video), where data is
hidden in parts of the file that result in the least change to the audible or visual output.
Another less popular steganography technique is the use of word or letter substitution.
Here, the sender of the secret message hides the text by distributing it inside a much larger
text, placing the words at specific intervals.
While this substitution method is easy to use, it may also make the text look strange and
out of place, since the secret words might not fit particularly well into their target
sentences.
There are other types of steganography, such as hiding an entire partition on a hard drive,
or embedding data in the header section of files and network packets. The effectiveness of
these methods depends on how much data they can hide and how easy they are to detect.
Malicious hackers use steganography for a variety of tasks such as hiding malicious
payloads and script files. Malware developers often use LSB steganography to hide the code
for their malware in images of celebrities and famous songs and execute them with another
program after the file is downloaded on the victim’s computer.
“The term ‘Trojan Horse’ is used to describe a dangerous file hidden within a harmless file.
Macro attacks are a form of steganography as well,” Trustwave’s Winkler says.
“Steganography will be used by creative hackers whenever there is a need to bypass
protections.”
Cybercriminals, however, are not the only actors who use steganography on a daily basis.
Spies use the technique to communicate with their command center without arousing
suspicion among their hosts.
Tech-savvy human rights activists and dissidents also use steganography when they want to
send sensitive information.
Differences between steganography and cryptography
Steganography is often compared to cryptography. While steganography hides
information, cryptography focuses on rendering the data unreadable to everyone
except its intended recipient. Once a stream of data is encrypted, only a person
who has access to its decryption key will be able to unlock it.
But if cryptography provides better protection for secret data, why use
steganography at all?
The presence of cryptography reveals that something is hidden, and in many
cases, this is enough to get the sender in trouble.
“In a highly monitored country, like say China or Iran or North Korea,
cryptographic files can be detected and the very fact you are sending/receiving
them could raise suspicion,” says security researcher John Ortiz.
“When they show up and put a gun to your head for the key, even the most secure
crypto is worthless.”
“Steganography and encryption are not actually mutually exclusive,” says Jerome
Segura, director of threat intelligence at Malwarebytes. “The former is mainly a
way to conceal data within an image file, but that data doesn’t have to be in clear
text either.”
Recent examples of steganography :
Detecting steganography can be very tricky, but recent examples of steganography detected
in malicious attacks include:
January 2020: Researchers at Malwarebytes reported credit card skimmer code hidden in
image files in compromised e-commerce websites.
January 2020: Researchers at Guardicore Labs discovered a cryptominer that was hidden
inside WAV audio files.
August 2019: Researchers at TrendMicro find a new variant of keylogger and
cryptocurrency stealer malware LokiBot which uses steganography to hide its malicious
code inside a jpeg file.
April 2019: a former GE engineer was charged with economic espionage. The employee had
encrypted files containing GE’s proprietary information and hidden them in a photo of a
sunset.
February 2019: researchers at ad fraud prevention firm Devcon discovered a malvertising
campaign using steganography to hide malicious JavaScript code.
December 2018: Malicious actors used steganography to hide malicious code in Twitter
memes.
Block ciphers & DES
A block cipher is an encryption/decryption scheme in which
a block of plaintext is treated as a whole and used to
produce a cipher text block of equal length.
A block cipher encrypts a block of PT into CT of equal
length. That means it operates on PT block of ‘n’bits to
produce a CT block of ‘n’ bits.
Block ciphers divide a plaintext into identically sized
blocks. Generally, the blocks are of length greater than or
equal to 64 bits. The same transformations are applied to
each block to perform the encryption.
All the widely known secret-key block-cipher algorithms
exhibit the cryptographic properties desired in a block
cipher. Foremost of these is the fact that each bit of the
cipher text should depend on all key bits.
Changing any key bit should result in a 50 percent chance of
changing any resulting cipher text bit. Furthermore, no statistical
relationships should be inferable between a plaintext and its
corresponding cipher text. In the reminder of this section, we
present the most common secret-key block-cipher algorithms.
Generally a block of 64 or 128 bits is used. There are 2n possible
different PT blocks for encryption & decryption.
For an ‘n’ bit general substitution block cipher ,the size of the
key is n X 2n.
For example : For 64 bit block, the key size is 64 X 264 ≈ 270
≈ 1021 bits.
Feistel proposed a cipher concept that- we can approximate
simple substitution cipher by the concept of product cipher. i.e.
performing of 2 or more basic ciphers in sequence such that the
final result or product is cryptographically stronger.
Claude Shannon during 1945 , proposed a product cipher
proposes CONFUSION & DIFFUSION functions.
This idea is to thwart crypto analysis based on statistical
analysis, where;
In Diffusion, The statistical structure of PT is dissipated into
long range statistics of cipher text. That means each CT digit
is affected by many PT digits.
For example: A message M is diffused to encrypt as below;
M = m1,m2,m3,……….with averaging function,
yn = ∑ki=1 mn+i ( mod 26)
M = 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010
1011 1100 1101 1110 1111
L = 0000 0001 0010 0011 0100 0101 0110 0111
R = 1000 1001 1010 1011 1100 1101 1110 1111
The first bit of M is "0". The last bit is "1". We read from left to right.
DES operates on the 64-bit blocks using key sizes of 56- bits. The keys
are actually stored as being 64 bits long, but every 8th bit in the key
is not used (i.e. bits numbered 8, 16, 24, 32, 40, 48, 56, and 64).