CYB 135 Wk 5 – Apply: Labs

0 items
CYB 135 Wk 5 - Apply: Labs
CYB 135 Wk 5 – Apply: Labs
$10.00
  • Description

CYB 135 Wk 5 – Apply: Labs

Complete zyLabs 5.15–5.16 in zyBooks. You have unlimited attempts in Develop mode. Toggle to Submit mode for a grade.

Encryption methods, such as the Caesar Cipher encryption, allow us to encrypt and decrypt text using a special key. Another method of encrypting text / passwords is called hashing. Hashing uses special algorithms to ‘scramble’ the text, which is tougher to be hacked. The hash function can take numbers, letters, and symbols as input, then the function applies one of the special algorithms to output the scrambled text. The longer the output string is, the harder to hack the hashed data. The difference between hashing and the Caesar Cipher encryption is that one cannot ‘decrypt’ a hashed data to its original text.

Since a hashed data cannot be decrypted, a user must enter the original text, which will be hashed by the program. Then the program compares the hashed value with the hashed data stored previously for the original text. A salt is used, at times, to create a random sequence that is added to the original text before using the hashing algorithm. This can help prevent the Brute Force attacks from using 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. To apply an hashing algorithm, import the hashlib module and specify the hashing algorithm and an encoding format to be used. A common encoding format is ‘utf-8’.

Given hash_function( ) defined in the default template, complete the main function that does the following tasks:

  • Create a list called hash_list that contains the five hashing algorithm names described above.
  • Read from the user a password to hash.
  • Declare a salt variable and initialize the variable to the hex representation of 4458585599393. Hint: Use function hex().
  • Use a for loop to iterate over the hash_list and call the hash_function() with the hashing algorithm names in the list. Store the returned value of hash_function() in a variable and output the algorithm name used and the hashed password. Note: Output a new line after each hashed password is printed.

hash_function( ) takes three parameters: the password to be hashed, a salt containing the hex representation of a 13-digit number, and a hashing algorithm name. hash_function( ) applies a specific hashing algorithm to the combination of the password and the salt value. hash_function( ) then returns a text containing the hashed data in hex representation and the salt value.