Hash256, password | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hash256, password

Hi.I have a task to access some password which its algorithm is given in a csv file with name. Such as this: Daniel,99b057c8e3461b97f8d...... And i have to put the code in a fuction and only use these 2 libraries: Csv and sha256 And because the code is being checked by a system and gives me a grade, i can't change the main structure.please check if i got it import csv from hashlib import sha256 def hash_password_hack(input_file_name, output_file_name): hash_password_to_password = {} with open(input_file_name, newline='') as f: psswords_singer = csv.reader(h) with open(output_file_name, 'w', newline='') as f: writer = csv.writer(w, delimiter=',') for password in range(1000,10000): hashing_number = sha256(b'%i'% password).hexdigest() hash_password_to_password[hashing_number] = password for row in psswords_singer: name_users = row[0] for key in row[1:] : writer.writerow([name_users,hash_password_to_password[key]])

21st Mar 2021, 8:03 PM
tara
tara - avatar
3 Answers
+ 2
The system itself gives the file to the code as an example. I solved it without the function and by giving the file address. But we have to use a function so that the checking system can use it to check different files
21st Mar 2021, 9:32 PM
tara
tara - avatar
+ 1
how should we check it without csv sample?
21st Mar 2021, 9:23 PM
iTech
iTech - avatar
+ 1
at least in which colon the hash is located?
21st Mar 2021, 9:56 PM
iTech
iTech - avatar