R20 20CS1001 - CRDS Question Bank With Answers
R20 20CS1001 - CRDS Question Bank With Answers
(AUTONOMOUS)
Siddharth Nagar, Narayanavanam Road – 517583
Traffic analysis: If we had encryption protection in place, an opponent might still be able to
observe the pattern of the message. The opponent could determine the location and identity of
communication hosts and could observe the frequency and length of messages being exchanged.
This information might be useful in guessing the nature of communication that was taking place.
Passive attacks are very difficult to detect because they do not involve any alteration
of data. However, it is feasible to prevent the success of these attacks.
Active attacks
These attacks involve some modification of the data stream or the creation of a false stream.
These attacks can be classified in to four categories:
Masquerade – One entity pretends to be a different entity.
Replay – involves passive capture of a data unit and its subsequent transmission to produce an
unauthorized effect.
Repudiation – This attack occurs when the network is not completely secured or the login control
has been tampered with. With this attack, the author‘s information can be changed by actions of a
malicious user in order to save false data in log files, similar to the spoofing of e-mail messages.
Modification of messages – Some portion of message is altered or the messages are delayed or
recorded, to produce an unauthorized effect.
Denial of service – Prevents or inhibits the normal use or management of communication facilities.
Another form of service denial is the disruption of an entire network, either by disabling the
network or overloading it with messages so as to degrade performance.
In substitution Cipher Technique, plain text In transposition Cipher Technique, plain text
1. characters are replaced with other characters, characters are rearrangedwith respect to the
numbers and symbols. position.
Substitution Cipher‘s forms are:Mono Transposition Cipher‘s forms are: Key-less
2. alphabetic substitution cipher and poly transposition cipher and keyed transposition
alphabetic substitution cipher. cipher.
In substitution Cipher Technique,character‘s While in transposition Cipher Technique, The
3. identity is changed while its position remains position of the character is changed but character‘s
unchanged. identity is not changed.
While in transposition Cipher Technique, The
In substitution Cipher Technique, The letter
4. Keys which are nearerto correct key can disclose
with low frequency candetect plain text.
plain text.
The example of substitution Cipheris Caesar The example of transposition Cipher isRail Fence
5.
Cipher. Cipher.
3. a. Examine the properties of Security Mechanisms. [L3][CO1] [8M]
Encryption or encryption-like transformations of information are the most common means
of providing security.
b.Summarize the relation between key range and key size in cryptography? [L2][CO1] [5M]
KEY RANGE
The concept of key range and key-size are related to each other. Key Range is total number of keys
from smallest to largest available key. An attacker usually is armed with the knowledge of the
cryptographic algorithm and the encrypted message, so only the actual key value remains the
challenge for the attacker.
• If the key is found, the attacker can get original plaintext message. In the brute force attack,
every possible key in the key-range is tried, until we get the right key.
• In the best case, the right key is found in the first attempt, in the worst case, the key is found in
the last attempt. On an average, the right key is found after trying half of the possible keys in the
key-range. Therefore by expanding the key range toa large extent, longer it will take for an attacker
to find the key using brute-force attack.
• The concept of key range leads to the principle of key size. The strength of a cryptographic key is
measured with the key size.
KEY SIZE
• Key size is measured in bits and is represented using binary number system. Thus if the key
range from 0 to 8, then the key size is 3 bits or in other words we can say if the size is bits then the
key range is 0 to 256. Key size may be varying, depending upon the applications and the
cryptographic algorithm being used, it can be 40 bits, 56 bits, 128 bits & so on. In order to protect
the cipher-text against the brute-force attack, the key-size should be such that the attacker can not
crack it within a specified amount of time.
• From a practical viewpoint, a 40-bit key takes about 3 hours to crack, however a 41-bit key
would take 6 hours and 42-bit key would take 12 hours & so on. This means every additional bit
doubles the amount of time required to crack the key. We can assume that 128 bit key is quite safe,
considering the capabilities of today‘s computer.
Spoofing
As it pertains to cybersecurity, is when someone or something pretends to be something else in an
attempt to gain our confidence, get access to our systems, steal data, steal money, or spread malware.
Spoofing attacks come in many forms, including:
Email spoofing
Website and/or URL spoofing
Caller ID spoofing
Text message spoofing
GPS spoofing
Man-in-the-middle attacks
Extension spoofing
IP spoofing
Facial spoofing
For example, a spoofed email from PayPal or Amazon might inquire about purchases you never
made. Concerned about your account, you might be motivated to click the included link.
From that malicious link, scammers will send you to a web page with a malware download or a faked
login page—complete with a familiar logo and spoofed URL—for the purpose of harvesting your
username and password.
There are many more ways a spoofing attack can play out. In all of them, fraudsters rely on victims
falling for the fake. If you never doubt the legitimacy of a website and never suspect an email of
being faked, then you could become a victim of a spoofing attack at some point.
To that end, this page is all about spoofing. We'll educate you on the types of spoofs, how spoofing
works, how to discern legitimate emails and websites from fake ones, and how to avoid becoming a
target for fraudsters.
Phishing
Phishing attacks are the practice of sending fraudulent communications that appear to come from a
reputable source. It is usually done through email. The goal is to steal sensitive data like credit card
and login information, or to install malware on the victim‗s machine. Phishing is a common type of
cyber attack that everyone should learn about in order to protect themselves.
CIPHER-TEXT = ―GSGSEKFREKEOE‖
ROW TRANSPOSITION CIPHERS:
A more complex scheme is to write the message in a rectangle, row by row, and read the
message off, column by column, but permute the order of the columns. The order of columns then
becomes the key of the algorithm.
A pure transposition cipher is easily recognized because it has the same letter frequencies
as the original plaintext. The transposition cipher can be made significantly more secure by
performing more than one stage of transposition. The result is more complex permutation that is
not easily reconstructed.
Decryption
1. To decipher it, the recipient has to work out the column lengths by dividing the message length
by the key length.
2. Then, write the message out in columns again, then re-order the columns by reforming the key
word.
b.Discuss Play fair cipher in Detail. [L2][CO1] [6M]
The best known multiple letter encryption cipher is the playfair, which treats diagrams
in the plaintext as single units and translates these units into cipher text digrams. The playfair
algorithm is based on the use of 5x5 matrix of letters constructed using a keyword. Let the keyword
be “MONARCHY”. The matrix is constructed by filling in the letters of the keyword (minus
duplicates) from left to right and from top to bottom, and then filling in the remainder of the matrix
with the remaining letters in alphabetical order.
The letter ―i‖ and ―j‖ count as one letter. Plaintext is encrypted two letters at a time according to
the following rules:
Repeating plaintext letters that would fall in the same pair are separated with a Filler letter such as
„x‟.
Plaintext letters that fall in the same row of the matrix are each replaced by the letter to the
right, with the first element of the row following the last.
Plaintext letters that fall in the same column are replaced by the letter beneath, with the top
element of the column following the last.
Otherwise, each plaintext letter is replaced by the letter that lies in its own row and the column
occupied by the other plaintext letter.
10. Indicate any three Symmetric key cipher techniques. [L2][CO1] [12M]
CAESAR CIPHER (OR) SHIFT CIPHER
The earliest known use of a substitution cipher and the simplest was by Julius Caesar. The
Caesar cipher involves replacing each letter of the alphabet with the letter standing 3 places
further down the alphabet.
e.g., Plain text : pay more money , Cipher text: SDB PRUH PRQHB
For each plaintext letter p, substitute the cipher text letter c such that C = E(p) = (p+3) mod 26
A shift may be any amount, so that general Caesar algorithm is C = E (p) = (p+k) mod 26
Where k takes on a value in the range 0 to 25. The decryption algorithm is simplyP = D(C) = (C-k)
mod 26
MONOALPHABETIC CIPHERS:
Monoalphabetic cipher is a substitution cipher, where the cipher alphabet for eachplain text alphabet
is fixed, for the entire encryption.
In simple words, if the alphabet ‗p‘ in the plain text is replaced by the cipher alphabet ‗d‘. Then in
the entire plain text wherever alphabet ‗p‘ is used, it will bereplaced by the alphabet ‗d‘ to form the
ciphertext.
With only 25 possible keys, the Caesar cipher is far from secure. A dramatic increase in the key
space can be achieved by allowing an arbitrary substitution. A permutation of a finite set of
elements S is an ordered sequence of all the elements of S, with each element appearing exactly
once.
For example, if S = {a, b, c}, there are six permutations of S:abc, acb, bac, bca, cab, cba
In general, there are n! permutations of a set of n elements, because the first element can be chosen
in one of n ways, the second in n - 1 ways, the third in n – 2 ways, and so on.
Plain Text: a b c d e f g h i j k l m n o p q r s t u v w x y z
Caesarcipher: d e f g h i j k l m n o p q r s T u v w x y z a b c
Eg: Plain Text: Plain Text: meet me tomorrow
Cipher Text: phhw ph wrpruurz
If, instead, the ―cipher‖ line can be any permutation of the 26 alphabetic characters, then there are 26! or
greater than 4 * 1026 possible keys.
This is 10 orders of magnitude greater than the key space for DES and would seem to eliminate
brute-force techniques for cryptanalysis. Such an approach is referred to as a mono alphabetic
substitution cipher, because a single cipher alphabet (mapping from plain alphabet to cipher alphabet) is
used per message.
Monoalphabetic ciphers are easy to break because they reflect the frequency data of the original
alphabet.
POLYALPHABETIC CIPHER
Polyalphabetic cipher is far more secure than a monoalphabetic cipher. As monoalphabetic cipher
maps a plain text symbol or alphabet to a ciphertext symbol and uses the same ciphertext symbol
wherever that plain text occurs in the message.
But polyalphabetic cipher, each time replaces the plain text with the different ciphertext.
A polyalphabetic cipher is any cipher based on substitution, using multiple substitution
alphabets. The Vigenère cipher is probably the best-known example of a polyalphabetic
cipher.
UNIT-II CONVENTIONAL ENCRYPTION
1. a. Illustrate Conventional encryption model. [L3][CO2] [6M]
Conventional encryption is a cryptographic system that uses the same key used by the sender to
encrypt the message and by the receiver to decrypt the message.It was the only type of encryption in use
prior to the development of public-key encryption.
It is still much preferred of the two types of encryption systems due to its simplicity. It is a
relatively fast process since it uses a single key for both encryption and decryption
Suppose A wants to send a message to B, that message is called plaintext. Now, to avoid hackers
reading plaintext, the plaintext is encrypted using an algorithm and a secret key (at 1). This encrypted
plaintext is called ciphertext. Using the same secret key and encryption algorithm run in reverse(at 2), B
can get plaintextof A, and thus the message is read and security is maintained.
Conventional encryption has mainly 5 ingredients:
1. Plain text: It is the original data that is given to the algorithm as an input.
2. Encryption algorithm: This encryption algorithm performs various transformations on plaintext to
convert it into cipher text.
3. Secret key: The secret key is also an input to the algorithm. The encryption algorithm will produce
different outputs based on the keys used at that time.
4. Cipher text : It contains encrypted information because it contains a form of originalplaintext that is
unreadable by a human or computer without proper cipher to decrypt it. It is output from
the algorithm.
5. Decryption algorithm: This is used to run encryption algorithms in reverse. Cipher text andSecret
key is input here and it produces plain text as output.
Requirements for secure use of conventional encryption:
1. We need a strong encryption algorithm.
2. The sender and Receiver must have obtained copies of the secret key in a secure fashion and must
keep the key secure.
Advantages of Conventional Encryption:
1. Simple: This type of encryption is easy to carry out.
2. Uses fewer computer resources: Conventional encryption does not require a lot of computer
resourceswhen compared to public-key encryption.
3. Fast : Conventional encryption is much faster than asymmetric key encryption.
Disadvantages of Conventional Encryption Model:
1. Origin and authenticity of the message cannot be guaranteed, since bothsender and receiver use the
same key, messages cannot be verified to have come from a particular user.
2. It isn‟t much secured when compared to public-key encryption.
3. If the receiver lost the key, he/she cant decrypt the message and thus making the whole process
useless.
4. This scheme does not scale well to a large number of users because boththe sender and the receiver
have to agree on a secret key before transmission.
b. State and explain the principles of public key cryptography? [L1][CO2] [6M]
Key distribution under symmetric key encryption requires either
(1)That two communicants already share a key, which someone has been distributed to them or
(2) The use of a key distribution center.
Public key cryptosystems
Public key algorithms rely on one key for encryption and a different but related keyfor decryption.
These algorithms have the following important characteristics:
It is computationally infeasible to determine the decryption key given only the knowledge of the
cryptographic algorithm and the encryption key.
In addition, some algorithms, such as RSA, also exhibit the following characteristic:
Either of the two related keys can be used for encryption, with the other used fordecryption.
The essential steps are the following:
Each user generates a pair of keys to be used for encryption and decryption ofmessages.
Each user places one of the two keys in a public register or other accessible file.
This is the public key. The companion key is kept private.
If A wishes to send a confidential message to B, A encrypts the message usingB‟s public key.
When B receives the message, it decrypts using its private key. No other recipient can decrypt the message
because only B knows B‟s private key.
With this approach, all participants have access to public keys and private keys are generated locally by
each participant and therefore, need not be distributed. As long as a system controls its private key, its
incoming communication is secure.
Let the plaintext be X=[X1, X2, X3, …,Xm] where m is the number of letters in some finite
alphabets. Suppose A wishes to send a message to B. B generates a pair of keys: a public key KUb and a
private key KRb. KRb is known only to B, whereas KUb is publicly available and therefore accessible by
A.With the message X and encryption key KUb as input, A forms the cipher text Y=[Y1, Y2, Y3, …
Yn]., i.e., Y=E KUb(X)
The receiver can decrypt it using the private key KRb. i.e., X=D KRb(Y). The encrypted message serves
as a digital signature.
It is important to emphasize that the encryption process just described does not provide confidentiality.
There is no protection of confidentiality because any observer can decrypt the message by using the
sender‟s public key.
It is however, possible to provide both the authentication and confidentiality by a double use of the
public scheme.
Initially, the message is encrypted using the sender‟s private key. This provides the digital signature.
Next, we encrypt again, using the receiver‟s public key. The final ciphertext can be decrypted only by the
intendedreceiver, who alone has the matching private key. Thus confidentiality is provided.
Thus, C = KP mod26, where C= Column vectors of length 3 ,P = Column vectors of length 3 K= 3x3
encryption key matrix.
For decryption process, inverse of matrix K is done.Plaintext is recovered by applying K-1 to the cipher
text. It is expressed as C = EK(P) = KP mod26
P = DK(C) = K-1C mod26.
Example: The plain text is: I can’t do it, and the size of M is 3 and key K is chosen as following
MONOALPHABETIC CIPHERS:
Monoalphabetic cipher is a substitution cipher, where the cipher alphabet for each plain text
alphabet is fixed, for the entire encryption.
In simple words, if the alphabet „p‟ in the plain text is replaced by the cipher alphabet „d‟. Then
in the entire plain text wherever alphabet „p‟ is used, it will be replaced by the alphabet „d‟ to form the
ciphertext.
With only 25 possible keys, the Caesar cipher is far from secure. A dramatic increase in the key
space can be achieved by allowing an arbitrary substitution. A permutation of a finite set of elements S is
an ordered sequence of all the elements of S, with each element appearing exactly once.
For example, if S = {a, b, c}, there are six permutations of S:abc, acb, bac, bca, cab, cba
In general, there are n! permutations of a set of n elements, because the first element can be chosen in one
of n ways, the second in n - 1 ways, the third in n – 2 ways, and so on.
Plain Text: a b c d e f g h i j k l m n o p q r s t u v w x y z
Caesarcipher: d e f g h i j k l m n o p q r s t u v w x y z a b c
Eg: Plain Text: meet me tomorrow
Cipher Text: phhw ph wrpruurz
If, instead, the “cipher” line can be any permutation of the 26 alphabetic characters, then thereare 26! or
greater than 4 * 1026 possible keys.
This is 10 orders of magnitude greater than the key space for DES and would seem to eliminate brute-
force techniques for cryptanalysis. Such an approach is referred to as a mono alphabetic substitution
cipher, because a single cipher alphabet (mapping from plain alphabet to cipher alphabet) is used per
message.
Monoalphabetic ciphers are easy to break because they reflect the frequency data of the originalalphabet.
The double encrypted cipher-text block is first decrypted using the key K2 to make the singly encrypted
cipher text. This ciphertext block is then decrypted using the key K1 to acquire the original plaintext
block.
If it can use a key of only 1 bit, there are two possible keys including 0 and 1. If it can use a 2
bit key, there are four possible key values such as (00, 01, 10 and 11). In general, if it can use an n-bit key,
the cryptanalyst has to implement 2n operations to try out all the possible keys. If it can use two different
keys, each including n bits,the cryptanalyst would require 22n attempt to crack the key.
Double DES needed a key search of (22*56), i. e. , 2112keys. It introduce the terms of the meet-in-
the-middle attack. This attack contains encryption from one end, decryption from the other and
connecting the results in the middle.
Consider that the cryptanalyst understand two basic pieces of information including P (a plain-
text block) and C (the corresponding final cipher-text block) for a message. The numerical expression of
Double DES as shown in the figure.
The result of the first encryption is known as T and is indicated as T = Ek1(P) [i.e., encrypt the block P
with key K1]. After this encrypted block is encrypted with another key K2, it indicate the result as C =
EK2(EK1(P)) [i.e., encrypt the already encrypted block T, with a different key K2, and call the final
ciphertext as C].
TRIPLE DES
The speed of exhaustive key searches against DES after 1990 began to cause discomfort amongst
users of DES. However, users did not want to replace DES as it takes an enormous amount of time and
money to change encryption algorithms that are widely adopted and embedded in large security
architectures.
The pragmatic approach was not to abandon the DES completely, but to change the manner in
which DES is used. This led to the modified schemes of Triple DES (sometimes known as 3DES).
Incidentally, there are two variants of Triple DES known as 3-key Triple DES (3TDES) and 2-key Triple
DES (2TDES).
3-KEY Triple DES
Before using 3TDES, user first generate and distribute a 3TDES key K, which consists of three different
DES keys K1, K2 and K3. This means that the actual 3TDES key has length 3×56 = 168 bits. The
encryption scheme is illustrated as follows −
b.Derive Ceasar cipher algorithm, encrypts the message using the Plain Text"POLYMORPHIC" and Key
k=3.[L3][CO2][4M]
The earliest known use of a substitution cipher and the simplest was by Julius Caesar. The Caesar cipher
involves replacing each letter of the alphabet with the letter standing 3 places further down the
alphabet.
PLAIN TEXT = POLYMORPHIC, KEY=3, CIPHER TEXT = SROBPRUSKLF
For each plaintext letter p, substitute the cipher text letter c such that C = E(p) = (p+3) mod 26
A shift may be any amount, so that general Caesar algorithm is C = E (p) = (p+k) mod 26
Where k takes on a value in the range 0 to 25.
The decryption algorithm is simplyP = D(C) = (C-k) mod 26
4. Summarize one time pad and Polyalphabetic cipher methods with example. [L4][CO2][12M]
ONE TIME PAD CIPHER
One Time Pad algorithm is the improvement of the Vernam Cipher. It is a method of encrypting
alphabetic plain text. It is one of the Substitution techniques which converts plain text into ciphertext.
In this mechanism, we assign a number to each character of the Plain-Text.
The two requirements for the One-Time pad are
The key should be randomly generated as long as the size of the message.
The key is to be used to encrypt and decrypt a single message, and then it is discarded.
So encrypting every new message requires a new key of the same length as the new message in one -
time pad. The key used for a one-time pad cipher is called pad.
Advantage:
Encryption method is completely unbreakable for a ciphertext only attack.
Disadvantages
It requires a very long key which is expensive to produce and expensive to transmit.
Once a key is used, it is dangerous to reuse it for a second message; any knowledge on the first message
would give knowledge of the second.
POLYALPHABETIC CIPHER
Polyalphabetic cipher is far more secure than a monoalphabetic cipher. As monoalphabetic cipher maps a
plain text symbol or alphabet to a ciphertext symbol and uses the same ciphertext symbol wherever that
plain text occurs in the message.
But polyalphabetic cipher, each time replaces the plain text with the different ciphertext.
A polyalphabetic cipher is any cipher based on substitution, using multiple substitution alphabets. The
Vigenère cipher is probably the best-known example of a polyalphabetic cipher.
Strength of Vigenere cipher
There are multiple cipher text letters for each plaintext letter.
Letter frequency information is obscured.
CIPHER-TEXT = “GSGSEKFREKEOE”
ROW TRANSPOSITION CIPHERS:
A more complex scheme is to write the message in a rectangle, row by row, and read the message off,
column by column, but permute the order of the columns.The order of columns then becomes the key of the
algorithm.
A pure transposition cipher is easily recognized because it has the same letter frequencies as the original
plaintext. The transposition cipher can be made significantly more secure by performing more than
one stage of transposition. The result is more complex permutation thatis not easily reconstructed.
Decryption
1. To decipher it, the recipient has to work out the column lengths by dividing the message length by
the key length.
2. Then, write the message out in columns again, then re-order the columns by reforming the key word.
AFFINE CIPHER
The Affine cipher is a type of mono alphabetic substitution cipher, where in each letter in an
alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and
converted back to a letter.
The whole process relies on working modulo m (the length of the alphabet used). In the affine
cipher, the letters of an alphabet of size m are first mapped to the integers in the range 0 … m-1.
The „key‟ for the Affine cipher consists of 2 numbers, we‟ll call them a and b. The following discussion
assumes the use of a 26 character alphabet (m = 26). a should be chosen to be relatively prime to m (i.e. a
should have no factors in common with m).
Encryption
It uses modular arithmetic to transform the integer that each plaintext letter corresponds to into another
integer that correspond to a ciphertext letter. The encryption function for a single letter is
E ( x ) = ( a x + b ) mod m ,
Modulus m: size of the alphabet
a and b: key of the cipher, where a must be chosen such that a and m are coprime.
Decryption
In deciphering the ciphertext, we must perform the opposite (or inverse) functions on the cipher text to
retrieve the plaintext. Once again, the first step is to convert each of the cipher text letters into their
integer values. The decryption function is
D ( x ) = a^-1 ( x - b ) mod m
a^-1 : modular multiplicative inverse of a modulo m.
The round key is 48 bits. The input is 32 bits. This input is first expanded to 48 bits by using a table that
defines a permutation plus an expansion that involves duplication of 16 of the bits.
The resulting 48 bits are XOR ed . This 48-bit result passes through a substitution function that produces
a 32-bit output.
64 bit plain text goes under initial permutation and then given to round 1. Since initial permutation
step receiving 64 bits, it contains an 1×64 matrix which contains numbers from 1 to 64 but in shuffled
order. After that, we arrange our original 64 bit text in the order mentioned in that matrix.
After initial permutation, 64 bit text passed through 16 rounds. In each round it processed with 48 bit
key. That means we need total 16 sub keys, one for each round. See below diagram, it will show what
happening in each round of algorithm.
Round i: In each round 64bit text divided into two 32bit parts. Left and Right. You can see in diagram Li-1
and Ri-1. As algorithm says, Right 32bits goes under Expansion Permutation.
Expansion Permutation: Right side 32bit part of text given to expansion permutation. It will produce a
48bit text as output. i.e. 16bits added in this step. Some bits below 32 are repeated and arranged in an
1×48 matrix form. We rearrange 32bit text by following the order of that matrix. After expansion
permutation we have to XOR the output 48bit with a 48bit sub key. Let see how that 48bit sub key
generating from 64bit original key.
Permutated Choice 1: Initially we take a 64 bit key and then apply to permutated choice 1. It contains a
1×56 matrix but with shuffled 1 to 64 numbers except multiples of number 8. i.e. 8, 16, 24, 32, 40, 48, 56,
64 will be discarded.
Remaining 64-8 = 56 number will be there in 1×56 matrix. We rearrange key inmatrix specified order.
Left Circular Shift: 56 bit key from permutated choice 1 given to left circular shift operation. Here that
56 bit key divided into two equal halves of each 28bit. These 28bits shifted depends upon the round
number. We already have the data that in each round how many bits circularly we have to shift. You can
see this data in shifts array in code.
Permutated Choice 2: Result of Left circular shift 56bit key given to permutated choice 2. This step will
produce 48bit sub key. For this it has an 1×48 matrix, in which out of 56, some random 8 bits will be
discarded. And remaining 48 will be there. According to this bit positions we have to rearrange the key.
You can see this matrix in below code.
Now output of permutated choice 2 will be Xor with output of expansion permutation, which results a
48bit one. This 48bit again reduced to 32bit using Substitution boxes [called S box].
Substitution boxes [S box]:
In DES algorithm we have 8 S boxes. Input for S box is 48bit. And output from S box is 32 bit.
The input 48 bit will be divided equally to 8 s boxes from s1, s2, … s8. So each s box will get 48/8= 6
bits as input. This Each S box reduce 6 bits to 4 bits. i.e input for each S box is 6 bits and output is 4 bits.
Finally, 8*4 = 32 bit. Which is final output of S box operation.
Let see how 6bits converted to 4 bits from S box. S box is an 4×16 matrix containing numbers in
range 0 to 15. Take example, assume input 6 bits for S box are 011011. In this first and last bit together
represents row number. Since maximum number with two bits is 3, S box also contains 0 to 3 rows total
of 4 and middle 4 numbers together represent column number.
Since maximum number with 4 bits is 15, S box also contains columns 0 to 15 total of 16. So
here first and last bit = 01 i.e. row number 1 and middle bits 1101= 13 i.e. column number 13. So for this
input the number positioned at row 1 and column 13 will be picked. As mentioned earlier S box only
contains number in range 0 to 15. All can be represented in 4 bits. So picked number 4 bits are output for
the S box.
Permutation: After getting output from all S boxes, we are applying again permutation. Here also a
matrix with different arrangements will be there, we haveto arrange according to that.
Final XOR: After this permutation, take the left half which initially divided 64bit text to two halves. Do
XOR with this permutation output to left 32bit part. This result is new Right part. And Right 32bit part
which passed through all permutation will be come as new Left Part. These 2 parts will be the inputs for
thesecond round. Same as keys also, the parts before left shift are next round input keys.
All this explanation for a single round for a 62bit plain text. Like this, it passesthrough total 16 rounds.
32 bit swap: After completion of 16 rounds, final 64 bits divided into two 32 bit parts and they swap
each other.
Inverse Initial Permutation: Here also a matrix will be there, in which bits arejust shuffled. No adding
or subtracting bits. See the code for this matrix.
8. Write short notes on block cipher principles? Explain the block cipher modes of
operation. [L1][CO2][12M]
Feistel Cipher is not a specific scheme of block cipher. It is a design model from which many
different block ciphers are derived. DES is just one example of a Feistel Cipher. A cryptographic system
based on Feistel cipher structure uses the same algorithm for both encryption and decryption.
Encryption Process
The encryption process uses the Feistel structure consisting multiple rounds of processing of the plaintext,
each round consisting of a “substitution” step followed by a permutation step.
Encryption algorithms are divided into two categories based on the input type, asa block cipher
and stream cipher. Block cipher is an encryption algorithm that takes a fixed size of input say b bits and
produces a ciphertext of b bits again. If the input is larger than b bits it can be divided further.
Block cipher modes of operation
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 ciphertext. Generally, if a message is larger than b bits in size, it can be broken down into a
bunch of blocks and the procedure is repeated.
Counter Mode (CM) – The Counter Mode or CTR is a simple counter-based block cipher
implementation. Every time a counter-initiated value is encrypted and given as input to XOR with
plaintext which results in ciphertext block. The CTR mode is independent of feedback use and thus can
be implemented in parallel. Its simple implementation is shown below:
Advantages of Counter
Since there is a different counter value for each block, the direct plaintext and ciphertext relationship
is avoided. This means that thesame plain text can map to different ciphertext.
Parallel execution of encryption is possible as outputs from previousstages are not chained as in the
case of CBC.
If hackers defeat the encryption algorithm, they are able to add to or change the encrypted
message without being noticed. Stream ciphers are typically used to encrypt data in an application where
the volume of plain text cannot be predicted and in low latency use-cases.
Types of Stream Ciphers
1. Synchronous Stream Ciphers
In a synchronous stream cipher, the keystream block is created independently of the previous
ciphertext and plaintext messages. The most popular stream cipher modes produce a string of bits using
pseudorandom number generators and combine it with the key to create the keystream, which is
then XORed with the plaintext to produce the ciphertext.
2. Self-Synchronizing/Asynchronous stream Ciphers
The previous ciphertext block's fixed size (N-bits) and symmetric key are used to generate the keystream
block via a self-synchronizing stream cipher, also known as ciphertext autokey. Asynchronous stream
cipher can recognize active attacks by altering the ciphertext, which changes the information in the
subsequent keystream.
b.Discuss key distribution in detail. [L2][CO2][6M]
For symmetric encryption to work, the two parties to an exchange must share the same key, and that key
must be protected from access by others. Furthermore, frequent key changes are usually desirable to limit
the amount of data compromised if an attacker learns the key. For two parties A and B, key distribution
can be achieved in a number of ways, as follows:
1. A can select a key and physically deliver it to B.
2. A third party can select the key and physically deliver it to A and B.
3. If A and B have previously and recently used a key, one party can transmitthe new key to the other,
encrypted using the old key.
4. If A and B each has an encrypted connection to a third party C, C can delivera key on the encrypted
links to A and B.
The use of a key distribution center is based on the use of a hierarchy of keys. At a minimum, two
levels of keys are used. Communication between end systems is encrypted using a temporary key, often
referred to as a session key. Accordingly, session keys are transmitted in encrypted form, using a master
key that is shared by the key distribution center and an end system or user.
The Use of a Key Hierarchy
Looking at the left-hand side of the figure, we can see that the processing of the plaintext proceeds in three
phases. First, the 64-bit plaintext passes through an initial permutation (IP) that rearranges the bits to
produce the permuted input. This is followed by a phase consisting of 16 rounds of the same function,
which involves both permutation and substitution functions. The output of the last (sixteenth) round
consists of 64 bits that are a function of the input plaintext and the key. The left and right halves of the
output are swapped to produce the preoutput.
Finally, the preoutput is passed through a permutation (IP-1) that is the inverse of the initial
permutation function, to produce the 64-bit ciphertext. With the exception of the initial and final
permutations, DES has the exact structure of a Feistel cipher.
Initial Permutation: The initial permutation and its inverse are defined by tables.The input to a table
consists of 64 bits numbered from 1 to 64.The 64 entries in the permutation table contain a permutation of
the numbers from 1 to 64.
Round Function
The heart of this cipher is the DES function, f. The DES function applies a 48-bit key to the right most
32 bits to produce a 32-bit output.
Expansion Permutation Box: Since right input is 32-bit and round key is a 48-bit, we first need to
expand right input to 48 bits. Permutation logic isgraphically depicted in the following illustration
XOR (Whitener). − After the expansion permutation, DES does XOR operation on the expanded right
section and the round key. The round key is used only in this operation.
Substitution Boxes. − The S-boxes carry out the real mixing (confusion). DES uses 8 S-boxes, each
with a 6-bit input and a 4-bit output. Refer thefollowing illustration –
There are a total of eight S-box tables. The output of all eight s-boxes isthen combined in to 32 bit
section.
Key Generation
The round-key generator creates sixteen 48-bit keys out of a 56-bit cipher key. Each entry in the
permutation table indicates the position of a numbered input bit in the output, which also consists of 64
bits.
UNIT-III ASYMMETRIC KEY CIPHERS
1. a.Explain the RSA algorithm. Compute cipher text for M=88, p=17, q=11, e=7.[L2][CO3] [8M]
It is the most common public key algorithm.This RSA name is get from its inventors first letter
(Rivest (R), Shamir (S) and Adleman (A)) in the year 1977.
The RSA scheme is a block cipher in which the plaintext & ciphertext are integers between 0 and
n-1 for some n.
Description of the Algorithm:
RSA algorithm uses an expression with exponentials.
In RSA plaintext is encrypted in blocks, with each block having a binary value less than some
number n. That is, the block size must be less than or equal to log2(n)
RSA uses two exponents e and d where e public and d private.
Encryption and decryption are of following form, for some PlainText M and CipherText block C
Both sender and receiver must know the value of n. The sender knows the value of e & only the
receiver knows the value of d thus this is a public key encryption algorithm with a Public key
PU={e, n} Private key PR={d, n}.
Steps of RSA algorithm:
Step 1→Select 2 prime numbers p & q
Step 2→Calculate n=pq
Step 3→Calculate Ø(n)=(p-1)(q-1)
Step 4→ Select or find integer e (public key) which is relatively prime to Ø(n). ie., e with gcd
(Ø(n), e)=1 where 1<e< Ø(n).
Step 5→ Calculate “d” (private key) by using following condition. d< Ø(n).
Step 6→ Perform encryption by using
Step 7→ performDecryption by using
Example:
1. Select two prime numbers, p = 17 and q = 11.
2. Calculate n = pq = 17 × 11 = 187. 3.
3.Calculate Ø(n) = (p - 1)(q - 1) = 16 × 10 = 160.
4. Select e such that e is relatively prime to Ø(n) = 160 and less than Ø (n); we choose e = 7.
5. Determine d such that de ≡1 (mod 160) and d < 160.The correct value is d = 23, because 23 * 7 =
161 = (1 × 160) + 1; d can be calculated using the extended Euclid‟s algorithm
6. The resulting keys are public key PU = {7, 187} and private key PR = {23, 187}.
plaintext input of M= 88.
b. Write about the strength of RSA?[L1][CO3][4M]
It is very easy to implement RSA algorithm.
RSA algorithm is safe and secure for transmitting confidential data.
Cracking RSA algorithm is very difficult as it involves complex mathematics.
Sharing public key to users is easy.
Encryption strength totally lies on the key size and if we double or triple the key size, the strength
of encryption increases exponentially.
RSA keys can be typically 1024 or 2048 bits long, but experts believe that 1024-bit keys could be
broken in the near future.
2. Compute Cipher text for Plain text =”DECRYPTION”, P=11, D=3, E1=2,
R=4(Random Integer) plain text=7,using Elgamal Cryptography [L3][CO3][12M]
Solution:
Given, q=7 , Xb=4 , Xa=3
According to algorithm,
Step 1: q=7
Step 2:α=3
Step 3: Ya=αXa mod q
=33 mod 7
=6
Step 4: Yb=αXb mod q
=34 mod 7
=4
Step 5:
K1=(Ya)Xb mod q
=64 mod 7
=1
K2=(Yb)Xa mod q
=43 mod 7
=1
The operation of the digital signature is similar to that of the MAC. In the case of the digital
signature, the hash value of a message is encrypted with a user‟s private key. Anyone who knows
the user‟s public key can verify the integrity of the message that is associated with the digital
signature. In this case, an attacker who wishes to alter the message would need to know the user‟s
private key.
RSA Digital Signature Schemes – Key Generation Key generation in the RSA digital signature
scheme is exactly the same as key generation in the RSA.
1. Sender chooses two prime numbers p and q
2. Calculate n=pxq
3. Calculate f(n) = (p-1) x (q-1)
4. Chooses the public exponent e and calculates d (private exponent) such that e x d = 1 mod f(n) In
the RSA digital signature scheme, d is private; e and n are public.
When Bob and Alice are communicating over a network, they might want to create a unique
encryption key for each session. This is often achieved by using X448, and uses ECDH (Elliptic Curve
Diffie Hellman). With this we select a base x co-ordinate point of G, and then Bob and Alice generate
random values, and determine their public keys. Alice generates a long-term private key of a, and Bob
generates a long term private key of b. Alice‟s long public key will be:
b. Explain the concepts of Random Bit Generation.[L2][CO4][5M]
Random number generation is a process by which, often by means of a random number
generator (RNG), a sequence of numbers or symbols that cannot be reasonably predicted better than
by random chance is generated. This means that the particular outcome sequence will contain some
patterns detectable in hindsight but unpredictable to foresight.
True random number generators (TRNG), which operate by measuring a well-controlled and
specially prepared physical process. Randomness of a TRNG can be precisely, scientifically
characterized and measured. Especially valuable are the information-theoretic provable random
number generators (RNGs), which, at the state of the art, seem to be possible only by exploiting
randomness inherent to certain quantum systems.
PRF: Pseudorandom functions are not to be confused with pseudorandom generators (PRGs). The
guarantee of a PRG is that a single output appears random if the input was chosen at random.
A PRF is an efficient (i.e. computable in polynomial time), deterministic function that maps two
distinct sets (domain and range) and looks like a truly random function.
A PRF is considered to be good if its behavior is indistinguishable from a truly random function.
Therefore, given an output from either the truly random function or a PRF, there should be no
efficient method to correctly determine whether the output was produced by the truly random
function or the PRF.
7.Demonstrate the Structure of AES and its transformations.[L2][CO4][12M]
Advanced Encryption Standard (AES) is a specification for the encryption of electronic data
established by the U.S National Institute of Standards and Technology (NIST) in 2001. AES is
widely used today as it is a much stronger than DES and triple DES despite being harder to
implement.
AES is a block cipher.
The key size can be 128/192/256 bits.
Encrypts data in blocks of 128 bits each.
That means it takes 128 bits as input and outputs 128 bits of encrypted cipher text as output. AES
relies on substitution-permutation network principle which means it is performed using a series of
linked operations which involves replacing and shuffling of the input data.
Working of the cipher:
AES performs operations on bytes of data rather than in bits. Since the block size is 128 bits, the
cipher processes 128 bits (or 16 bytes) of the input data at a time.
The number of rounds depends on the key length as follows :
128 bit key – 10 rounds
192 bit key – 12 rounds
256 bit key – 14 rounds
Creation of Round keys:
A Key Schedule algorithm is used to calculate all the round keys from the key. So the initial key
is used to create many different round keys which will be used in the corresponding round of the
encryption.
Encryption:
AES considers each block as a 16 byte (4 byte x 4 byte = 128 ) grid in a column major
arrangement.Each round comprises of 4 steps :
SubBytes
ShiftRows
MixColumns
Add Round Key
The last round doesn‟t have the MixColumns round.
The SubBytes does the substitution and ShiftRows and MixColumns performs the permutation in
the algorithm.
SubBytes :
In this step each byte is substituted by another byte. Its performed using a lookup table also called
the S-box. This substitution is done in a way that a byte is never substituted by itself and also not
substituted by another byte which is a compliment of the current byte. The result of this step is a
16 byte (4 x 4 ) matrix like before.
The next two steps implement the permutation.
ShiftRows :
This step is just as it sounds. Each row is shifted a particular number of times.
The first row is not shifted
The second row is shifted once to the left.
The third row is shifted twice to the left.
The fourth row is shifted thrice to the left.
(A left circular shift is performed.)
MixColumns :
This step is basically a matrix multiplication. Each column is multiplied with a specific matrix
and thus the position of each byte in the column is changed as a result.
After all these rounds 128 bits of encrypted data is given back as output. This process is repeated
until all the data to be encrypted undergoes this process.
8.Discuss about key scheduling and round transformation of IDEA.[L2][CO4][12M]
In cryptography, block ciphers are very important in the designing of many cryptographic
algorithms and are widely used to encrypt the bulk of data in chunks. By chunks, it means that the
cipher takes a fixed size of the plaintext in the encryption process and generates a fixed size
ciphertext using a fixed-length key. An algorithm‟s strength is determined by its key length.
It uses a fixed-length plaintext of 16 bits and encrypts them in 4 chunks of 4 bits each to
produce 16 bits ciphertext.
The length of the key used is 32 bits.
The key is also divided into 8 blocks of 4 bits each.
Rounds − There are eight round in IDEA. Each round contains a sequence of operations on the four
data blocks, utilizing six keys. The Add * and Multiply * in the following step of each round are not
easy addition and multiplication but they are addition module 216 i.e., 65536 and Multiplication
Module 216 + 1 i. e. , 65537.
This algorithm involves a series of 4 identical complete rounds and 1 half-round. Each complete
round involves a series of 14 steps that includes operations like:
Bitwise XOR
Addition modulo
Multiplication modulo
Key Schedule: 6 subkeys of 4 bits out of the 8 subkeys are used in each complete round, while 4
are used in the half-round. So, 4.5 rounds require 28 subkeys. The given key, „K‟, directly gives the
first 8 subkeys. By rotating the main key left by 6 bits between each group of 8, further groups of 8
subkeys are created, implying less than one rotation per round for the key (3 rotations).
Single Round:The 16-bit plaintext can be represented as X1 || X2 || X3 || X4, each of size 4 bits.
The 32-bit key is broken into 8 subkeys denoted as K1 || K2 || K3 || K4 || K5 || K6 || K7 || K8, again
of size 4 bits each. Each round of 14 steps uses the three algebraic operation-Addition modulo
(2^4), Multiplication modulo (2^4)+1 and Bitwise XOR. The steps involved are as follows:
1. X1 * K1
2. X2 + K2
3. X3 + K3
4. X4 * K4
5. Step 1 ^ Step 3
6. Step 2 ^ Step 4
7. Step 5 * K5
8. Step 6 + Step 7
9. Step 8 * K6
10. Step 7 + Step 9
11. Step 1 ^ Step 9
12. Step 3 ^ Step 9
13. Step 2 ^ Step 10
14. Step 4 ^ Step 10
The input to the next round is Step 11 || Step 13 || Step 12 || Step 14, which becomes X1 || X2 || X3 ||
X4. This swap between 12 and 13 takes place after each complete round, except the last complete
round (4th round), where the input to the final half round is Step 11 || Step 12 || Step 13 || Step 14.
After last complete round, the output Transformation is as follows:
1. X1 * K1
2. X2 + K2
3. X3 + K3
4. X4 * K4
The final output is obtained by concatenating the blocks.
Output Transformation − It is a one-time operation. It takes place at the end of the 8th round.
Therefore 64-bit value is divided into four sub-blocks (say R1 to R4) and four subkeys are used here.
9. Evaluate the structure of blowfish algorithm and list out the merits and
Demerits.[L1][CO4][8M]
Blowfish is an encryption technique designed by Bruce Schneier in 1993 as an alternative to DES
Encryption Technique. It is significantly faster than DES and provides a good encryption rate with
no effective cryptanalysis technique found to date. It is one of the first, secure block cyphers not
subject to any patents and hence freely available for anyone to use.
1. blockSize: 64-bits
2. keySize: 32-bits to 448-bits variable size
3. number of subkeys: 18 [P-array]
4. number of rounds: 16
5. number of substitution boxes: 4 [each having 512 entries of 32-bits each]
Step1: Generation of subkeys:
18 subkeys{P[0]…P[17]} are needed in both encryption as well as decryption process and the
same subkeys are used for both the processes.
These 18 subkeys are stored in a P-array with each array element being a 32-bit entry.
It is initialized with the digits of pi(?).
The hexadecimal representation of each of the subkeys is given by:
Now each of the subkey is changed with respect to the input key as:
P[0] = P[0] xor 1st 32-bits of input key
P[1] = P[1] xor 2nd 32-bits of input key
.
.
.
P[i] = P[i] xor (i+1)th 32-bits of input key
(roll over to 1st 32-bits depending on the key length)
.
.
.
P[17] = P[17] xor 18th 32-bits of input key
(roll over to 1st 32-bits depending on key length)
The resultant P-array holds 18 subkeys that is used during the entire encryption process
Step2: initialise Substitution Boxes:
4 Substitution boxes(S-boxes) are needed{S[0]…S[4]} in both encryption aswell as decryption
process with each S-box having 256 entries{S[i][0]…S[i][255], 0&lei&le4} where each entry is 32-
bit.
It is initialized with the digits of pi(?) after initializing the P-array.
Both sender and receiver must know the value of n. The sender knows the value of e & only the
receiver knows the value of d thus this is a public key encryption algorithm with a Public key
PU={e, n} Private key PR={d, n}.
Example:
1. Select two prime numbers, p = 17 and q = 11.
2. Calculate n = pq = 17 × 11 = 187. 3.
Calculate Ø(n) = (p - 1)(q - 1) = 16 × 10 = 160.
4. Select e such that e is relatively prime to Ø(n) = 160 and less than Ø (n); we choose e = 7.
5. Determine d such that de ≡1 (mod 160) and d < 160.The correct value is d = 23, because 23 * 7 =
161 = (1 × 160) + 1; d can be calculated using the extended Euclid‟s algorithm
6. The resulting keys are public key PU = {7, 187} and private key PR = {23, 187}.
The example shows the use of these keys for a plaintext input of M= 88. For encryption, we need to
calculate C = 887 mod 187.
Security of RSA
Four possible approaches to attacking the RSA algorithm are
• Brute force: This involves trying all possible private keys.
• Mathematical attacks: There are several approaches, all equivalent in effort to factoring the
product of two primes.
• Timing attacks: These depend on the running time of the decryption algorithm.
• Chosen ciphertext attacks: This type of attack exploits properties of the RSAalgorithm.
UNIT-IV
INTRODUCTION TO DATA SECURITY & IDS SECURITY
1. What is security attack? Explain different Types of Security attacks?[L2][CO5][12M]
Passive Attacks: Passive attacks are in the nature of eavesdropping on, or monitoring of,
transmissions. The goal of the opponent is to obtain information that is being transmitted.
Traffic analysis: If we had encryption protection in place, an opponent might still be able to
observe the pattern of the message. The opponent could determine the location and identity of
communication hosts and could observe the frequency and length of messages being exchanged.
This information might be useful in guessing the nature of communication that was taking place.
Passive attacks are very difficult to detect because they do not involve any alteration
of data. However, it is feasible to prevent the success of these attacks.
Active attacks
These attacks involve some modification of the data stream or the creation of a false stream.
Masquerade Attack
Replay – involves passive capture of a data unit and its subsequent transmission to produce an
unauthorized effect.
Repudiation – This attack occurs when the network is not completely secured or the login control
has been tampered with. With this attack, the author‟s information can be changed by actions of a
malicious user in order to save false data in log files, similar to the spoofing of e-mail messages.
Modification of messages – Some portion of message is altered or the messages are delayed or
recorded, to produce an unauthorized effect.
Denial of service – Prevents or inhibits the normal use or management of communication facilities.
Another form of service denial is the disruption of an entire network, either by disabling the
network or overloading it with messages so as to degrade performance.
Encryption
Encryption is a method of transforming information to make it unreadable for unauthorized users by
using an algorithm. The transformation of data uses a secret key (an encryption key) so that the
transformed data can only be read by using another secret key (decryption key).
Access control
Access control defines rules and policies for limiting access to a system or to physical or virtual
resources. It is a process by which users are granted access and certain privileges to systems,
resources or information.
Authentication
An authentication is a process that ensures and confirms a user's identity or role that someone has. It
can be done in a number of different ways, but it is usually based on a combination of-
something the person knows (like a password),
Something the person is (like a human with a fingerprint).
Authorization
Authorization is a security mechanism which gives permission to do or have something. It is used to
determine a person or system is allowed access to resources, based on an access control policy,
including computer programs, files, services, data and application features.
Physical Security
Physical security describes measures designed to deny the unauthorized access of IT assets like
facilities, equipment, personnel, resources and other properties from damage. It protects these assets
from physical threats including theft, vandalism, fire and natural disasters.
2. Integrity
Integrity refers to the methods for ensuring that data is real, accurate and safeguarded from
unauthorized user modification. It is the property that information has not be altered in an
unauthorized way, and that source of the information is genuine.
Backups
Backup is the periodic archiving of data. It is a process of making copies of data or data files to use
in the event when the original data or data files are lost or destroyed. It is also used to make copies
for historical purposes, such as for longitudinal studies, statistics or for historical records or to meet
the requirements of a data retention policy.
Checksums
A checksum is a numerical value used to verify the integrity of a file or a data transfer. In other
words, it is the computation of a function that maps the contents of a file to a numerical value. A
checksum function depends on the entire contents of a file.
Data Correcting Codes
It is a method for storing data in such a way that small changes can be easily detected and
automatically corrected.
3. Availability
Availability is the property in which information is accessible and modifiable in a timely fashion by
those authorized to do so. It is the guarantee of reliable and constant access to our sensitive data by
authorized people.
Tools for Availability
Physical Protections
Computational Redundancies
Physical Protections
Physical safeguard means to keep information available even in the event of physical challenges. It
ensure sensitive information and critical information technology are housed in secure areas.
Computational redundancies
It is applied as fault tolerant against accidental faults. It protects computers and storage devices that
serve as fallbacks in the case of failures.
4. Discuss Hash Functions and Two Simple Hashing functions in detail. [L2][CO5][12M]
HASH FUNCTION
Hashing is the process of generating a value from a text or a list of numbers using a
mathematical function known as a hash function.
A hash function takes a string of inputs of any arbitrary size and converts them into unique
incomprehensible data of a fixed size.
Meaning, an input data of any length will be converted into a fixed-size hash. However, if you
change input values even slightly, the output hash will be completely different.
Values returned by a hash function are called message digest or simply hash values. The
following picture illustrated hash function −
Commonly used hash functions:
1. SHA (Secure Hash Algorithm): SHA is a family of cryptographic hash functions designed by
the National Security Agency (NSA) in the United States. The most widely used SHA algorithms
are SHA-1, SHA-2, and SHA-3.
SHA-1: SHA-1 is a 160-bit hash function that was widely used for digital signatures and other
applications. However, it is no longer considered secure due to known vulnerabilities.
SHA-2: SHA-2 is a family of hash functions that includes SHA-224, SHA-256, SHA-384, and
SHA-512. These functions produce hash values of 224, 256, 384, and 512 bits, respectively.
SHA-3: SHA-3 is the latest member of the SHA family and was selected as the winner of the
NIST hash function competition in 2012. It is designed to be faster and more secure than SHA-2
and produces hash values of 224, 256, 384, and 512 bits.
2. CRC (Cyclic Redundancy Check): CRC is a non-cryptographic hash function used primarily
for error detection in data transmission. It is fast and efficient but is not suitable for security
purposes. The basic idea behind CRC is to append a fixed-length check value, or checksum, to the
end of a message. When the message is received, the receiver can recalculate the checksum using
the same algorithm, and compare it with the checksum transmitted with the message.
3. MurmurHash: MurmurHash is a fast and efficient non-cryptographic hash function designed
for use in hash tables and other data structures. It is not suitable for security purposes as it is
vulnerable to collision attacks.
4. BLAKE2: BLAKE2 is a cryptographic hash function designed to be fast and secure. It is an
improvement over the popular SHA-3 algorithm and is widely used in applications that require
high-speed hashing, such as cryptocurrency mining.
BLAKE2 is available in two versions: BLAKE2b and BLAKE2s. BLAKE2b is optimized for 64-
bit platforms and produces hash values of up to 512 bits, while BLAKE2s is optimized for 8 - to
32-bit platforms and produces hash values of up to 256 bits.
5. Argon2: Argon2 is a memory-hard password hashing function designed to be resistant to brute-
force attacks. It is widely used for password storage and is recommended by the Password
Hashing Competition. The main goal of Argon2 is to make it difficult for attackers to crack
passwords by using techniques such as brute force attacks or dictionary attacks.
6. MD5 (Message Digest 5): MD5 is a widely-used cryptographic hash function that produces a
128-bit hash value. It is fast and efficient but is no longer recommended for security purposes due
to known vulnerabilities. The basic idea behind MD5 is to take an input message of any length,
and produce a fixed-length output, known as the hash value or message digest. This hash value is
unique to the input message, and is generated using a mathematical algorithm that involves a
series of logical operations, such as bitwise operations, modular arithmetic, and logical functions.
Features of Hash Functions
Fixed Length Output (Hash Value)
Hash function coverts data of arbitrary length to a fixed length. This process is often referred to
as hashing the data.
In general, the hash is much smaller than the input data, hence hash functions are sometimes
called compression functions.
Since a hash is a smaller representation of a larger data, it is also referred to as a digest.
Hash function with n bit output is referred to as an n-bit hash function. Popular hash functions
generate values between 160 and 512 bits.
TWO SIMPLE HASH FUNCTIONS
To get some feel for the security considerations involved in cryptographic hash functions, we
present two simple, insecure hash functions in this section. All hash functions operate using the
following general principles. The input (message, file, etc.) is viewed as a sequence of n-bit
blocks. The input is processed one block at a time in an iterative fashion to produce an n-
bit hash function.One of the simplest hash functions is the bit-by-bit exclusive-OR (XOR) of every
block. This can be expressed as
This operation produces a simple parity for each bit position and is known as a longitudinal
redundancy check. It is reasonably effective for random data as a data integrity check. Each n-bit
hash value is equally likely. Thus, the probability that a data error will result in
an unchanged hash value is 2-n. With more predictably formatted
data, the function is less effective. For example, in most normal text files, the high-order bit
of each octet is always zero. So if a 128-bit hash value is used, instead of an effectiveness of 2-
128, the hash function on this type of data has an effectiveness of 2-112.
A simple way to improve matters is to perform a one-bit circular shift is processed.
The procedure can be summa- rized as follows.
1. Initially set the n-bit hash value to zero.
2. Process each successive n-bit block of data as follows:
a. Rotate the current hash value to the left by one bit.
b. XOR the block into the hash value.
This has the effect of “randomizing” the input more completely and overcoming any regularities that
appear in the input.
Given a message, it is an easy matter to produce a new message that yields that hash code: Simply
prepare the desired alternate message and then append an n- bit block that forces the new
message plus block to yield the desired hash code.
Although a simple XOR rotated XOR (RXOR) is insufficient if only the hash
code is encrypted, you may still feel that such a simple function could be useful
when the message together with the hash code is encrypted But you must be careful. A technique
originally proposed by the National Bureau of Standards used the simple XOR applied to 64-bit
blocks of the message and then an encryption of the entire message that used
the cipher block chaining (CBC) mode. Given a message M consisting of a sequence of 64-bit
blocks X1, X2, Á , XN, define the hash code h = H(M) as
the block-by-block XOR of all blocks and append the hash code as the final block:
h = XN+1 = X1 Ⓧ X2 Ⓧ Á Ⓧ XN
Next, encrypt the entire message plus hash code using CBC mode to produce the
encrypted message Y1, Y2, ..... , YN+1.
Because the terms in the preceding equation can be XORed in any order, it follows
that the hash code would not change if the ciphertext blocks were permuted.
5. Design elliptic curve architecture and its functions briefly.[L6][CO5][12M]
Elliptical curve cryptography (ECC) is a public key encryption technique based on
elliptic curve theory that can be used to create faster, smaller and more efficient cryptographic
keys.
ECC is thought to be highly secure if the key size used is large enough. The U.S. government
requires the use of ECC with a key size of either 256 or 384 bits for internal communications,
depending on the sensitivity level of the information being transmitted.
ECC is an alternative to the Rivest-Shamir-Adleman (RSA) cryptographic algorithm
and is most often used for digital signatures in cryptocurrencies, such as Bitcoin and Ethereum, as
well as one-way encryption of emails, data and software.
Each of these cryptography mechanisms uses the concept of a one-way, or trapdoor, function.
But ECC is not necessarily any more or less secure compared to alternatives such as RSA.
The primary benefit of ECC is the inherent efficiencies gained when encrypting and decrypting
data.
An elliptic curve is not an ellipse, or oval shape, but it is represented as a looping line
intersecting two axes, which are lines on a graph used to indicate the position of a point. The
curve is completely symmetric, or mirrored, along the x-axis of the graph.
Elliptic Curve Cryptography (ECC) is an approach to public-key cryptography, based
on the algebraic structure of elliptic curves over finite fields. ECC requires a smaller key as
compared to non-ECC cryptography to provide equivalent security (a 256-bit ECC security has
equivalent security attained by 3072-bit RSA cryptography).
For a better understanding of Elliptic Curve Cryptography, it is very important to
understand the basics of the Elliptic Curve. An elliptic curve is a planar algebraic curve defined
by an equation of the form
Where „a‟ is the co-efficient of x and „b‟ is the constant of the equation
The curve is non-singular; that is, its graph has no cusps or self-intersections (when the
characteristic of the Coefficient field is equal to 2 or 3).
In general, an elliptic curve looks like as shown below. Elliptic curves can intersect almost 3
points when a straight line is drawn intersecting the curve. As we can see, the elliptic curve is
symmetric about the x-axis. This property plays a key role in the algorithm.
ECC is like most other public key encryption methods, such as the RSA algorithm and Diffie-
Hellman. Each of these cryptography mechanisms uses the concept of a one-way, or trapdoor,
function. This means that a mathematical equation with a public and private key can be used to
easily get from point A to point B. But, without knowing the private key and depending on the key
size used, getting from B to A is difficult, if not impossible, to achieve.
Uses
Websites make extensive use of ECC to secure customers„ hypertext transfer protocol connections.
It is used for encryption by combining the key agreement with a symmetric encryption scheme.
It is also used in several integer factorization algorithms like Lenstra elliptic-curve factorization.
Time stamping uses an encryption model called a blind signature scheme. It is possible using Elliptic
Curve Cryptography.
Macro Virus:
Unlike most viruses which are written in a low-level language(like C or assembly language), these are
written in a high-level language like Visual Basic. These viruses are triggered when a
program capable of executing a macro is run. For example, the macro viruses can be contained in
spreadsheet files.
Source code Virus:
It looks for source code and modifies it to include virus and to help spread it.
Polymorphic Virus:
A virus signature is a pattern that can identify a virus(a series of bytes that make up virus code). So
in order to avoid detection by antivirus a polymorphic virus changes each time it is installed. The
functionality of the virus remains the same but its signature is changed.
Encrypted Virus:
In order to avoid detection by antivirus, this type of virus exists in encrypted form. It carries a
decryption algorithm along with it. So the virus first decrypts and then executes.
Stealth Virus:
It is a very tricky virus as it changes the code that can be used to detect it. Hence, the detection of
viruses becomes very difficult. For example, it can change the read system call
such that whenever the user asks to read a code modified by a virus, the original form of code is
shown rather than infected code.
Tunneling Virus:
This virus attempts to bypass detection by antivirus scanner by installing itself in the interrupt handler
chain. Interception programs, which remain in the background of an operating system and catch
viruses, become disabled during the course of a tunneling virus. Similar viruses install themselves in
device drivers.
Multipartite Virus:
This type of virus is able to infect multiple parts of a system including the boot sector, memory, and
files. This makes it difficult to detect and contain.
Armored Virus:
An armored virus is coded to make it difficult for antivirus to unravel and understand. It uses a variety
of techniques to do so like fooling antivirus to believe that it lies somewhere else than its real location
or using compression to complicate its code.
Browser Hijacker:
As the name suggests this virus is coded to target the user„s browser and can alter the browser
settings. It is also called the browser redirect virus because it redirects your browser to other
malicious sites that can harm your computer system.
Resident Virus:
Resident viruses installation store for your RAM and meddle together along with your device
operations. They„re so sneaky that they could even connect themselves for your anti-virus software
program files.
9.a.Define firewall? Examine the need for firewalls and role of firewalls in
protecting networks.[L4][CO5][8M]
A firewall can be defined as a special type of network security device or a software program
that monitors and filters incoming and outgoing network traffic based on a defined set of security rules.
It acts as a barrier between internal private networks and external sources (such as the public Internet).
The primary purpose of a firewall is to allow non-threatening traffic and prevent malicious or
unwanted data traffic for protecting the computer from viruses and attacks.
A firewall is a cybersecurity tool that filters network traffic and helps users block malicious
software from accessing the Internet in infected computers.
A firewall system analyzes network traffic based on pre-defined rules. It then filters the traffic and
prevents any such traffic coming from unreliable or suspicious sources.
Functions of Firewall
As stated above, the firewall works as a gatekeeper. It analyzes every attempt coming to gain access to
our operating system and prevents traffic from unwanted or non-recognized sources.
Since the firewall acts as a barrier or filter between the computer system and other networks (i.e., the
public Internet), we can consider it as a traffic controller. Therefore, a firewall's primary function is to
secure our network and information by controlling network traffic, preventing unwanted incoming
network traffic, and validating access by assessing network traffic for malicious things such as hackers
and malware.
Generally, most operating systems (for example - Windows OS) and security software come with
built-in firewall support. Therefore, it is a good idea to ensure that those options are turned on.
Additionally, we can configure the security settings of the system to be automatically updated
whenever available.
Firewall built-in features:
Network Threat Prevention
Application and Identity-Based Control
Hybrid Cloud Support
Scalable Performance
Network Traffic Management and Control
Access Validation
Record and Report on Events
Limitations of Firewall
Firewalls cannot stop users from accessing malicious websites, making it vulnerable to internal
threats or attacks.
Firewalls cannot protect against the transfer of virus-infected files or software.
Firewalls cannot prevent misuse of passwords.
Firewalls cannot protect if security rules are misconfigured.
Firewalls cannot protect against non-technical security risks, such as social engineering.
Firewalls cannot stop or prevent attackers with modems from dialing in to or out of the internal
network.
Firewalls cannot secure the system which is already infected.
Types of Firewall
Proxy Firewall
Packet-filtering firewalls
Stateful Multi-layer Inspection (SMLI) Firewall
Unified threat management (UTM) firewall
Next-generation firewall (NGFW)
Network address translation (NAT) firewalls
b.Summarize
(i) Salami attack. [L2][CO5][4M]
A salami attack is a method of cybercrime that attackers or a hacker typically used to commit
financial crimes. Cybercriminals steal money or resources from financial accounts on a system one
at a time. This attack occurs when several minor attacks combine to create a sturdy attack. Salami
attacks are used for the commission of economic crimes.
Working of Salami attack
During this kind of attack, an awfully insignificant change is introduced that goes completely
unnoticed. As an example, a bank accountant inserts a program, into the bank‟s servers, that deducts
a satiny low amount of cash from the account of each customer. No account holder will probably
notice this unauthorized debit, but the bank accountant will make an outsized amount of cash each
month.
Types of Salami attacks:
Salami Slicing: Salami Slicing occurs when the attackers/hacker get customer information, like
Bank/credit card details and other similar sort of detail by using an online database the
attacker/hacker deduct an awfully touch of cash from each account and these amounts add up to an
oversized amount of cash and this can be often invisibly to deduct such amount. Because the
amount is tiny. As an example, suppose an attacker/hacker withdraws ₹0.0001 from each checking
account.
Penny Shaving: when the attackers/hacker steal money in small amounts. By using rounding to the
closest within the transactions. so, change is so small so, nobody can detect such dough in a single
transaction
(ii) Trap Door
The trap door is also known as the back door. In which, the Programmer designs a security or
secret code that gives a threat to the system.
The trap door program threat is one in which the designer keeps a hole in the program, so it can
be handled only by the designer. So, it is very difficult to track or find the hole in the program
and need to go through the entire source code.
This security hole helps the designer access that system. When the system is in an abnormal
state, if we take data backup it also contains hidden threats.
Attacks
The attacks by trap doors have impacted hundreds and thousands of systems to the threat. Even the
companies like Google and Microsoft have been a target to trap doors.
Each SA can be either AH or ESP. For host-to-host SAs, the mode may be either transport or
tunnel; otherwise it must be tunnel mode.
Case1. All security is provided between end systems that implement
IPsec. For any two end systems to communicate via an SA, they must share the appropriate secret
keys. Among the possible combinations are
a. AH in transport mode
b. ESP in transport mode
c. ESP followed by AH in transport mode (an ESP SA inside an AH SA)
d.Any one of a, b, or c inside an AH or ESP in tunnel mode
Case 2. Security is provided only between gateways (routers, firewalls, etc.) and no hosts
implement IPsec. The security architecture document specifies that only a single tunnel SA is needed
for this case. The tunnel could support AH, ESP, or ESP with the authenti- cation option. Nested
tunnels are not required, because the IPsec services apply to the entire inner packet.
Case 3. This builds on case 2 by adding end-to-end security. The same combi- nations discussed for
cases 1 and 2 are allowed here. The gateway-to-gateway tunnel provides either authentication,
confidentiality, or both for all traffic between end systems. When the gateway-to-gateway tunnel is
ESP, it also provides a limited form of traffic confidentiality.
Case 4. This provides support for a remote host that uses the Internet to reach an organization‟s firewall
and then to gain access to some server or workstation
behind the firewall. Only tunnel mode is required between the remote host and the firewall.As
in case 1, one or two SAs may be used between the remote host and the local host.
The receiver after receiving the encrypted data and signature on it, first verifies the signature using sender‟s
public key. After ensuring the validity of the signature, he then retrieves the data through decryption using his
private key.
6.Define Digital signature. Write down the steps followed in creating digital
signature. List the Benefits and drawbacks of digital signatures.[L1][CO6][12M]
A digital signature is a mathematical technique used to validate the authenticity and integrity of a
digital document, message or software. A signature confirms that the information originated from
the signer and has not been altered.
Key Generation Algorithms: Digital signature is electronic signatures, which assure that the
message was sent by a particular sender. While performing digital transactions authenticity and
integrity should be assured, otherwise, the data can be altered .
The steps followed in creating digital signature are :
1. Message digest is computed by applying hash function on the message and then message digest is
encrypted using private key of sender to form the digital signature.
2. Digital signature is then transmitted with the message.(message + digital signature is transmitted)
3. Receiver decrypts the digital signature using the public key of sender.
4. The receiver now has the message digest.
5. The receiver can compute the message digest from the message (actual message is sent with the
digital signature).
6. The message digest computed by receiver and the message digest (got by decryption on digital
signature) need to be same for ensuring integrity.
Message digest is computed using one-way hash function, i.e. a hash function in which
computation of hash value of a message is easy but computation of the message from hash value
of the message is very difficult.
9.Discuss about Digital Signature Standard approach. Identify the benefits and
Problems of DSS.[L2][CO6][12M]
Signature is a way of authenticating the data coming from a trusted individual. Similarly, digital
signature is a way of authenticating a digital data coming from a trusted source.
Digital Signature Standard (DSS) is a Federal Information Processing Standard(FIPS) which
defines algorithms that are used to generate digital signatures with the help of Secure Hash
Algorithm(SHA) for the authentication of electronic documents.
DSS only provides us with the digital signature function and not with any encryption or key
exchanging strategies.
Sender Side : In DSS Approach, a hash code is generated out of the message and following inputs
are given to the signature function –
1. The hash code.
2. The random number „k‟ generated for that particular signature.
3. The private key of the sender i.e., PR(a).
4. A global public key(which is a set of parameters for the communicating principles) i.e., PU(g).
These input to the function will provide us with the output signature containing two components –
„s‟ and „r‟. Therefore, the original message concatenated with the signature is sent to the receiver.
Receiver Side: At the receiver end, verification of the sender is done. The hash code of the sent
message is generated. There is a verification function which takes the following inputs –
1. The hash code generated by the receiver.
2. Signature components „s‟ and „r‟.
3. Public key of the sender.
4. Global public key.
The output of the verification function is compared with the signature component „r‟. Both the
values will match if the sent signature is valid because only the sender with the help of it private
key can generate a valid signature.
Benefits of advanced signature:
1.A computerized signature gives better security in the exchange. Any unapproved individual can‟t
do fakeness in exchanges.
2.You can undoubtedly follow the situation with the archives on which the computerized mark is
applied..
3.It is 100 percent lawful it is given by the public authority approved ensuring authority.
4.In the event that you have marked a report carefully, you can‟t deny it.
5.In this mark, When a record is get marked, date and time are consequently stepped on it.
6.It is preposterous to expect to duplicate or change the report marked carefully.
Burdens of computerized signature:
1.You really want to investigate all the similarity issues. In there are a great deal of similarity
settings like a refreshed rendition of driver and programming.
2.Programming is one of the main pressing concerns while utilizing a computerized signature
testament.
3.In this signature, Lost or burglary of keys and the utilization of weak storage spaces.
4.There is a more grounded need for a norm through which these various strategies can cooperate.
5.To successfully utilize a computerized signature, the two shippers and beneficiaries might need to
purchase computerized endorsements.
6.To work with computerized endorsements, the shipper and beneficiaries need to purchase check
programming at an expense.
10. a. Describe the steps taken to ensure security, signing the Digest in Digital Signature
algorithm.[L2][CO6][6M]
Following are the steps taken to ensure security:
The miniature version (digest) of the message is created by using a hash function.
The digest is encrypted by using the sender's private key.
After the digest is encrypted, then the encrypted digest is attached to the original message and sent
to the receiver.
The receiver receives the original message and encrypted digest and separates the two. The
receiver implements the hash function on the original message to create the second digest, and it
also decrypts the received digest by using the public key of the sender. If both the digests are
same, then all the aspects of security are preserved.
Signing the Digest
Public key encryption is efficient if the message is short. If the message is long, a public key
encryption is inefficient to use. The solution to this problem is to let the sender sign a digest of the
document instead of the whole document.
The sender creates a miniature version (digest) of the document and then signs it, the receiver
checks the signature of the miniature version.
The hash function is used to create a digest of the message. The hash function creates a fixed-size
digest from the variable-length message.
The two most common hash functions used: MD5 (Message Digest 5) and SHA-1 (Secure Hash
Algorithm 1). The first one produces 120-bit digest while the second one produces a 160-bit
digest.
A hash function must have two properties to ensure the success:
First, the digest must be one way, i.e., the digest can only be created from the message but
not vice versa.
Second, hashing is a one-to-one function, i.e., two messages should not create the same
digest.
b. Examine Secure Hash Algorithm and applications.[L4][CO6][6M]
SHA stands for secure hashing algorithm. SHA is a modified version of MD5 and used for
hashing data and certificates. A hashing algorithm shortens the input data into a smaller form
that cannot be understood by using bitwise operations, modular additions, and compression
functions.
It produces a unique hash in an unreadable format. This is to make your data secure and
unhackable.
Additionally, SHA uses MD5, SHA 1, or SHA 256 for symmetric cryptography. They generate
hash values to encrypt and decrypt data securely.
Hashing:
„Hashing‟ is a cryptographic process that is used to determine the authenticity of various inputs.
Additionally, it is used to validate the integrity of your files, documents, and other types of data
that floats all over the internet.
Hash:
A Hash is the result of a mathematical algorithm (Hash Function) that converts a simple data input
into an unreadable format. This „Simple‟ data could include any text, picture, audio, or video
converted into a string of characters.
Fundamentally, A hash function takes a string of inputs of any arbitrary size and converts them
into unique incomprehensible data of a fixed size.
Meaning, an input data of any length will be converted into a fixed-size hash. However, if you
change input values even slightly, the output hash will be completely different.
This is how a Hash generates a unique string of incomprehensible data for every slight change.
Now, let‟s understand the ‘Fixed Size’ aspect of the Hash.
The above example converted the input data into SHA 1 output. These SHA 1 outputs have a 160-
bit (20-byte) hash value. And, you can render them as 40 digits long. Whereas, The SHA 2 Family
hash is 224 bits long.
How does hash encryption work
Digital Signatures need hash functions to encrypt and decrypt their data. The receiver
receives these encrypted keys for further decryption.
Then the same Hash function generates a decrypted hash value. For a successful transmission, both
the Hash values must be the same. This implies, that the source is authentic and reliable.
Broken Hash
Hash functions create a unique hash value for every piece of data. Meaning, if you Hash the word
„Elon‟ it will yield a certain output. One that looks nothing like the text „Elon‟. If you change the
text „Elon‟ to „ELON‟ the hash value will be completely different. That‟s a good hash.
If a Hash DOESN‟T generate a unique output for every input, that‟s a security hazard and a Broken
Hash.
Applications of Hash Functions
There are two direct applications of hash function based on its cryptographic properties.
Password Storage
Hash functions provide protection to password storage.
Instead of storing password in clear, mostly all logon processes store the hash values of passwords
in the file.
The Password file consists of a table of pairs which are in the form (user id, h(P)).