Question: Please write this program in python. One important aspect of security in computer science is the concept of hashing: taking some text, and somehow converting

Please write this program in python. Please write this program in python. One important aspect of security

One important aspect of security in computer science is the concept of hashing: taking some text, and somehow converting it to a number. This is needed because many security algorithms work through math, so numbers are needed. Another important aspect is the use of the modulo operator (%). You've seen this -- it returns the remainder portion of a division. This is useful because unlike most other math operators, modulo is one-way. That is, I can tell you that I'm thinking of a number x, and when I mod it by 5, I get 3, but from this information alone, you don't know whether x is 3 or 8 or 13 or 18, or .... In this problem, we'll create a login screen, where the user must enter a password in order to see a secret message. We will give the user 3 chances to get the password right, and either print the secret message or a failure message (after 3 chances). First, write a program that takes one string. It will hash the string using the built-in Python function hash (try it on the shell) and modulo the value by a prime number (e.g. 541 -- this is very small in the computer science world but good enough for us). The program should then print this number. e.g. It should print 211 (result) when the string is "mypassword" (if you use 541 as the prime for example) At the top of the file, define a variable_KEY to be the result. Now, write the rest of the program. Each time you ask the user for the password, ask for the user's input, calculate the key and compare the value to_KEY. If the two match, the user (most likely) entered the correct password, otherwise he loses one chance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!