Question
Encrypting text allows us to encrypt and decrypt the text using a special key. Another method of encrypting text / passwords is called hashing. Hashing
Encrypting text allows us to encrypt and decrypt the text using a special key. Another method of encrypting text / passwords is called hashing. Hashing uses special algorithms to 'scramble' text so that it is tougher to hack. The hash function can take numbers, letters, and symbols then uses one of the special algorithms to output scrambled text. The longer the output string, the harder to hack the data. The difference between hashing and the Caesar Cipher encryption, is that you cannot 'decrypt' a hash to its original text.
Since a hashed password cannot be decrypted, the user has to enter the password and a program has to hash it and test that value with data stored previously for the password. A salt is used, at times, to create a random sequence that is added to the password before using the hashing algorithm. This can help with Brute Force attacks that attempt to use common words to gain access.
Python's hashlib module provides programmers with an API for accessing the different hashing algorithms. Some common hashing algorithms are: md5, sha1, sha224, sha256, and blake2b.
The module hashlib has to be imported into your code and a specific algorithm set. An encoding format has to be set, a common encoding format is 'utf-8'.
The hash_function( ) is defined in the default template. You need to complete the main function by creating a list called hash_list that contains the five hashing algorithm names described above. Then accept user input of a password to hash, and create a salt variable with 13 numbers and convert it to hex. Finally create a for loop that iterates over the hash_list, creates a new variable returned from a call to the hash_function sending each algorithms name and display info as described below. (There is an ending new line)
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