Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

run these python code with defrent random masege ( import hashlib import random def find _ collision ( ) : hashes = { } while

run these python code with defrent random masege (import hashlib
import random
def find_collision():
hashes ={}
while True:
message =''.join(chr(random.randint(0,255)) for _ in range(16))
sha1_hash = hashlib.sha1(message.encode()).hexdigest()
first_60_bits = sha1_hash[:15] # Extract the first 60 bits (15 nibbles)
if first_60_bits in hashes:
return message, hashes[first_60_bits]
else:
hashes[first_60_bits]= message
message1, message2= find_collision()
print("Collision found:")
print("Message 1:", message1)
print("Message 2:", message2))and shwe the output

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

Students also viewed these Databases questions