Computer Networks Questions & Answers – Hash Functions

This set of Computer Networks Multiple Choice Questions & Answers (MCQs) focuses on “Hash Functions”.

1. Which of the following equation is correct in case of hash function, where M = input, N = hash value, H = hash function?
a) H = M(N)
b) M = H(N)
c) N = H(M)
d) N = M(H)
View Answer

Answer: c
Explanation: M is a block of data that is accepted by the hash function. Hash function(H) accepts the input and hash function will be performed. N is the fixed length of hash value of the block of input.

2. What is/are the property(s) of a good hash function in case of producing outputs for set of inputs?
a) Apparently random hash values
b) Evenly distributed hash values
c) Apparently random and evenly distributed values
d) Evenly distributed but not apparently random values
View Answer

Answer: c
Explanation: When a huge set of input blocks are given to a hash function, a good hash function will result in unique random values with no relation between them. At the same all the hash values will be equal that is fixed length.

3. What is the core objective of the hash functions in producing hash values?
a) Integrity
b) Authenticity
c) Confidentiality
d) Security
View Answer

Answer: a
Explanation: Integrity means retrieving the lost data as soon as possible. Hash functions accomplish integrity, because, even one bit is changed in the data, it will result in a change of hash value with high probability.

4. What is the name for hash functions that are used in security applications?
a) Secured hash function
b) Cryptographic hash function
c) Security hash function
d) Crypt-analysis hash function
View Answer

Answer: b
Explanation: The cryptographic hash function is an algorithm, which is used in security applications. It is computationally infeasible to attack the algorithm. Because it doesn’t allow the attacker to crack either of its properties, that are collision free property and one-way property.

5. Which of the following application in which hash function is employed, refers hash value as message digest?
a) Message authentication
b) Virus detection
c) Digital signatures
d) One-way password file
View Answer

Answer: a
Explanation: The application “message authentication” is used to obtain the integrity of the message. Sender sends hash value of the message along with message, then receiver performs the same hash function on the message. If both the message digests are same, means, integrity is achieved.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What is the other name for key hash function, which is used in message authentication?
a) Message administration control
b) Message authentication code
c) Message administration code
d) Message authentication control
View Answer

Answer: b
Explanation: Message authentication code that is key hash function is mostly used in message authentication. This MAC function results a MAC value, by taking the input block of data and secret key. This MAC value is used to check whether data has changed or not.

7. What is Ci in the bit-by-bit XOR hash function, that is Ci = bi1 + bi2.….. + bim
a) Number of n bit blocks
b) ith bit of the hash code
c) ith bit in jth block
d) XOR operation
View Answer

Answer: b
Explanation: “m” is the number of n-bit blocks in the input, bij is the ith bit in the jth block, ci is the ith bit of the hash code. Operation between the bits is exclusive OR and this operation is performed on every input block.

8. When can we detect a collision if the hash values are same for two inputs, that is H(x) = H(y)?
a) When x < y
b) When x > y
c) When x = y
d) When x != y
View Answer

Answer: d
Explanation: Hash function’s primary objective is to provide integrity. No two inputs should have the same hash value, which causes the collision. Collisions are undesirable in hash functions.

9. What is the formula for pre-images of a given hash value, where data block length = b bits and hash code = n bits?
a) 2b-n
b) 2b+n
c) 2b/n
d) 2n/b
View Answer

Answer: a
Explanation: In the hash value h = H(x), x is the preimage of the hash value. 2b-n formula finds the total number of possible collisions for a hash value. Here b > n and 2b is the total number of possible messages, 2n is the total number of possible hash values.

10. Which of the following is not a basic property for employing hash function in practical applications?
a) Variable input size
b) Fixed output size
c) Efficiency
d) Preimage resistant
View Answer

Answer: d
Explanation: Hash function will produce fixed lengths of outputs and accepts any size of blocks as input. It is efficient to calculate. If these three requirements need to be met to implement hash function in practical applications.

11. Which of the following property of the hash function makes the hash function strong?
a) Efficiency
b) Preimage resistant
c) Second preimage resistant
d) Collision resistant
View Answer

Answer: d
Explanation: Hash function is referred as weak, when it only satisfies the Efficiency, preimage resistant, second image resistant, fixed length output, variable length input. It is referred as strong if it satisfies the collision resistant along with all of the above.

12. Brute force attack does not concentrate on bit length of the hash value.
a) True
b) False
View Answer

Answer: b
Explanation: The attacks that are on hash functions are brute force attack and crypt-analysis. Brute force attack mainly concentrates on the bit length of the hash function, whereas crypt-analysis concentrates on cryptographic algorithms.

Sanfoundry Global Education & Learning Series – Computer Networks.

To practice all areas of Computer Networks, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.