Question

Write a Python function named ‘genreate_sha256’ that generates all possible 7-digit pin and the corresponding sha256...

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’

Homework Answers

Answer #1
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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Suppose that a computer randomly generates four-digit codes to match ATM pin codes among {0000, 0001,...
Suppose that a computer randomly generates four-digit codes to match ATM pin codes among {0000, 0001, . . . , 9999}. Explain carefully why there are 10000 possible four-digit codes when the digits are among 0-9. Note that 10000 = 104. Explain how this connects the number of digits, the choice of digits, and the possible four-digit pin codes. Among the 10000 possible four-digit pin codes, how many involve exactly three 1s or exactly three 2s? Write out the possibilities....
Exercise 48. Suppose that a computer randomly generates four-digit codes to match ATM pin codes among...
Exercise 48. Suppose that a computer randomly generates four-digit codes to match ATM pin codes among {0000, 0001, . . . , 9999}. Explain carefully why there are 10000 possible four-digit codes when the digits are among 0-9. Note that 10000 = 104. Explain how this connects the number of digits, the choice of digits, and the possible four-digit pin codes. Among the 10000 possible four-digit pin codes, how many involve exactly three 1s or exactly three 2s? Write out...
Using Python, Implement a decryption function: Implement a function named decrypt that opens a file named...
Using Python, Implement a decryption function: Implement a function named decrypt that opens a file named input_file and decrypts its content using the opposite of the dictionary created using a key (which is a parameter of the function) and stores the decrypted file to a file named output_file. The input and output file names will be positional parameters. The key parameter should be a keyword-only optional parameter where the default value is “IT RAINS A LOT IN MILWAUKEE IN THE...
In PYTHON please: Write a function named word_stats that accepts as its parameter a string holding...
In PYTHON please: Write a function named word_stats that accepts as its parameter a string holding a file name, opens that file and reads its contents as a sequence of words, and produces a particular group of statistics about the input. You should report the total number of words (as an integer) and the average word length (as an un-rounded number). For example, suppose the file tobe.txt contains the following text: To be or not to be, that is the...
[Python] Write a function named "total_population" that takes a string then a list as parameters where...
[Python] Write a function named "total_population" that takes a string then a list as parameters where the string represents the name of a CSV file containing city data in the format "CountryCode,CityName,Region,Population,Latitude,Longitude" and the second parameter is a list where each element is itself a list containing 3 strings as elements representing the CountryCode, CityName, and Region in this order. Return the total population of all cities in the list. Note that the city must match the country, name, and...
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except...
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except that it only accepts the specified type of input. The function takes two arguments: r prompt: str r type: int, float, str The function will keep prompting for input until correct input of the specified type is entered. The function returns the input. If the input was specified to be a number ( float or int), the value returned will be of the correct...
PLEASE DO IT IN C++ ONLY. THE MIN-MAX DIGIT PROBLEM Write a function named minMaxDigit() that...
PLEASE DO IT IN C++ ONLY. THE MIN-MAX DIGIT PROBLEM Write a function named minMaxDigit() that accepts an integer as an input parameter and returns the largest and smallest digits using the two output parameters min and max. For example, the call minMaxDigit(68437, min, max) would set min to 3 and max to 8. If there is only one digit, then both min and max are set to the same value. The function has no return statement.
Write a python function that will taken in a df (dataframe) and return a dictionary with...
Write a python function that will taken in a df (dataframe) and return a dictionary with the corresponding data types. You may need to instantiate an empty dictionary in your function. The keys will be the column headers of the df and the values will be the data types.
C++ Write a function named timesOfLetter that reads an array and returns the number of times...
C++ Write a function named timesOfLetter that reads an array and returns the number of times of each lowercase vowel and each uppercase vowel appear in it using reference parameter. • Write a function named timesOfNumber that reads an array and returns the number of times of each odd number, and each even number appear in it using reference parameter. • Write a function named isChar() that determines the input is alphabetic or not during inputting. • Write a function...
Write a Python program named lastNameVolumes that finds the volumes of different 3 D objects such...
Write a Python program named lastNameVolumes that finds the volumes of different 3 D objects such as a cube, sphere, cylinder and cone. In this file there should be four methods defined. Write a method named cubeVolFirstName, which accepts the side of a cube in inches as an argument into the function. The method should calculate the volume of a cube in cubic inches and return the volume. The formula for calculating the volume of a cube is given below....