Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Computer science python 3 program 1. Run 2 hash functions for your name and verify them. I wrote a SHA251. Can someone code one for
Computer science python 3 program 1. Run 2 hash functions for your name and verify them. I wrote a SHA251. Can someone code one for SHA256?. Create a hash function using SHA256
import hashlib # print out the available hash algorithms print(hashlib.algorithms_available) print(hashlib.algorithms_guaranteed) hash_object = hashlib.md5(b'Hello World') # b in front of Hello World converts the string to bytes # b/c hash function only takes bytes as parameter print(hash_object.hexdigest()) # take the input from a console? mystring = input('Enter String to hash: ') # Assumes the default UTF-8 hash_object = hashlib.md5(mystring.encode()) print(hash_object.hexdigest()) # try SHA1 # produces 160 bit (20 bytes) hash values # 40 digits long # Count the output and verify it's 40 digits hash_object = hashlib.sha1(b'Hello World') hex_dig = hash_object.hexdigest() print(hex_dig)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started