Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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 (%). Yo u'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 informatio n 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 prin t the secret message or a failure message (after 3 chances).

PYTHON PROGRAMMIG .

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 re sult .

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93073121

Have any Question?


Related Questions in Computer Engineering

Are there more children diagnosed with autism spectrum

Are there more children diagnosed with Autism Spectrum Disorder (ASD) in states that have larger urban areas over states that are mostly rural? In the state of Pennsylvania, a fairly urban state, there are 245 eight year ...

How do you calculate the annual interest rate of 12

How do you calculate the annual interest rate of 12% compounded monthly. I know how to do for annually but not monthly. You are offered the opportunity to put some money away for retirement. You will receive 10 annual pa ...

Hayley motorcycle company just paid a dividend of 14 today

Hayley Motorcycle Company just paid a dividend of $1.4 today, and is expected to pay a dividend in year 1 of $1.8, a dividend in year 2 of $2.3, a dividend in year 3 of $2.9, and a dividend in year 4 of $3.8. After year ...

Please discuss the design principles that guide the authors

Please discuss the design principles that guide the authors of instruction sets in making the right balance. Provide examples of application of each of the three design principles while designing instruction sets.

Here is a hypothesis when deprived of food invertebrates

Here is a hypothesis: when deprived of food, invertebrates will lose weight more quickly when humidity is 60%. Please indicate which is your dependent variable (Y) & which is your independent variable (X) by labeling the ...

For the following c statement what is the corresponding

For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables f, g, h, and i are given and could be considered integers as declared in a C program. Use a minimal number of assem ...

Stack - java plz use simple java language netbeans 81 or

STACK - java, plz use simple java language, netbeans 8.1 or 8.2 1. Create a Stack class based on MyLinkedList class. Use this class in the following: 2. Create a new Java Application that has the following methods: 1. A ...

Consider the labor market of the telecom industry is

Consider the labor market of the telecom industry is originally at an equilibrium level E0 and w0. Assume that now the companies offer each employee an iPhone as employment benefit every year. The firms can get iPhone at ...

1i which of the following characterizes a market ordera a

1) i. Which of the following characterizes a market order? a) A market order, which is considered a small order, is when 100 shares of a stock are ordered b) A market order is when the investor specifies the maximum pric ...

Question hypothetically speaking you are assigned to a

Question: Hypothetically speaking, you are assigned to a committee of three to decide on a dress code for Campbellsville University Staff and Faculty. Only two of the three votes are required to pass this policy. In this ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As