Write a Python function named ‘genreate_sha256’ that generates all possible 7-digit pin and the corresponding sha256 hash values and saves it into a file named ‘rainbow.csv’
import hashlib
import csv
filename = "rainboww.csv"
fields = ['7digit_pin','hash_value']
with open(filename, 'w') as csvfile:
csvwriter = csv.writer(csvfile)
csvwriter.writerow(fields)
for i in range(1000000, 9999999):
arr = []
arr.append(i)
result = hashlib.sha256(str(i).encode())
print(i)
print(result.hexdigest())
arr.append(result.hexdigest())
csvwriter.writerow(arr)
since the size of generated hash value file is 666 mb i couldnt upload the file.
Get Answers For Free
Most questions answered within 1 hours.