Menu

[Solved]Help Finish Code C Reads File Username First Password Second One Function Encrypt Passwor Q37229794

Help finish code in c++

Reads in a file that has a username(first) and apassword(second). One function will encrypt the password using theformula g(m), call the hashfunction to find index and store it intothe list.

.void plaintext insert(string usr, string pass This function takes the plaintext password and the user and will hash the pass

This hash function should return the index to store the key pair. Remember you are doing h(x) here.

All in all we get the following hash function we will use to encrypt our passwords g(m)-m mod 80543327

The hash function is h(x) x mod 23 where x is the decimal representation that the password is hashed to g(m).

CODE:

int hashFunction(int x){

//h(x)=x mod 23

return x%size;

void plaintext_insert(string usr, stringpass){

//will hash the password

int number;

//Used for hashing a password

const int n=80543327;

double m=0;

for(int i=0; i<pass.length();i++)

{

  m+=pass[i];

}

m=pow(m,7);

if(m<0)

{

  m=-m;

}

number= fmod(m,n);

//call the hash function to find out the index

hashFunction(number);

//insert into the table

int insert=hashFunction(number);

if(htable[insert]==NULL)//nothing in here

{

//NEED HELP

}

OUTPUT:

input File: Jorge letmein Jorge letmeout Jorge secretaccount Gewali secretaccount Rustlord 141515 JasonBourne 471 DavidWebb

.void plaintext insert(string usr, string pass This function takes the plaintext password and the user and will hash the password then call the hash function to find out the index to store the pair and will then insert it in the front of the linked list (or add it as first spot if it’s empty). Remember it stores the user in plaintext BUT it stores the password as int hash of password! Look at sample output for details This hash function should return the index to store the key pair. Remember you are doing h(x) here. All in all we get the following hash function we will use to encrypt our passwords g(m)-m mod 80543327 The hash function is h(x) x mod 23 where x is the decimal representation that the password is hashed to g(m). ‘input’ File: Jorge letmein Jorge letmeout Jorge secretaccount Gewali secretaccount Rustlord 141515 JasonBourne 471 DavidWebb 471 megalol0 anonymous wut wut Gewali secret123 Indiana Jones Luke 123abc Leia 123abc Ben theforce HanSolo falconllparsec fortnite flossdance apex legends padme qira anakin theChOsenOne Show transcribed image text .void plaintext insert(string usr, string pass This function takes the plaintext password and the user and will hash the password then call the hash function to find out the index to store the pair and will then insert it in the front of the linked list (or add it as first spot if it’s empty). Remember it stores the user in plaintext BUT it stores the password as int hash of password! Look at sample output for details
This hash function should return the index to store the key pair. Remember you are doing h(x) here.
All in all we get the following hash function we will use to encrypt our passwords g(m)-m mod 80543327
The hash function is h(x) x mod 23 where x is the decimal representation that the password is hashed to g(m).
‘input’ File: Jorge letmein Jorge letmeout Jorge secretaccount Gewali secretaccount Rustlord 141515 JasonBourne 471 DavidWebb 471 megalol0 anonymous wut wut Gewali secret123 Indiana Jones Luke 123abc Leia 123abc Ben theforce HanSolo falconllparsec fortnite flossdance apex legends padme qira anakin theChOsenOne

Expert Answer


Answer to Help finish code in c++ Reads in a file that has a username(first) and a password(second). One function will encrypt the… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *