Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment -Hash Functions Finding collisions and preimages of hash functions Use the birthday attack to generate a collision in a reduced version of SHA-1 (just

image text in transcribed

Assignment -Hash Functions Finding collisions and preimages of hash functions Use the birthday attack to generate a collision in a reduced version of SHA-1 (just a 40-bit hash). To find the hash value of a string s, you can execute the following Python code: import hashlib hashval=hashlib.shal(s.encode('utf-8')).hexdigest() We will use the high-order 40 bits (ten hex digits) as the 'hash value', so as to make this problem do-able. Problem 1: Basic birthday attack on a 40-bit hash Finding collision of any two messages Write a function birthdayl() that returns a tuple (s; t; n); where s and t are different ASCII strings whose SHA-1 hashes have the same high-order 40 bits (same 10 initial hex digits). The last component n of the return value is the number of calls to SHA-1. Again, you can generate random ASCII strings by converting random integers to hex. By the theory of these birthday attacks, you will need to compute somewhat more than 1 million =square root of 240 =220 hashes to find this collision with probability greater than 1/2. The simplest way to do it is to repeatedly generate random strings s and enter the pair SHA-1(s):s in a Python dictionary structure. When you find a hash value that's already in the dictionary, you're done. Include two different colliding pairs of strings in your writeup. In addition, specify the time needed to find the collided pairs. Problem 2: Finding First preimages Implement a program using python to find the first preimage of a hash function output. Finding first preimage is defined as "Given H, the attacker tries to find m where it has the hash value H. if H has an output of the first 10 initial hex digits of the SHA-1 hashes, write a program to find the preimage of ABCDEF0123. Specify the time needed to find the preimage M, and compare this time with the previous times in problems 1. Problem 3: Finding Second preimages Here you will start by computing the hash value H of your name M, and then search for a random ASCII string M2 that has the same hash value as your name M1. you still need to use the same 10 initial hex digits of the SHA-1 hash. In addition, specify the time needed to find the second pair. Compare this time with the previous time in problem 1 and 2.ss

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

Am I providing feedback consistently?

Answered: 1 week ago

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago