Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi I need this in C++ code please , using the hashing functions as written below. We need to build a server that can store

Hi I need this in C++ code please, using the hashing functions as written below.

image text in transcribedimage text in transcribed

We need to build a server that can store secret notes for users. The server can store/show/d the secret notes when the user enters his credentials. You can store the users' credentials (username password) in plaintext on the server. So, when the user enters the username and password, the se retrieves the user's notes and prints it. Storing the user's credentials as plain text is not a secure strategy. If someone could hack the serv could easily find the stored credentials and unravel all the user's secret notes. One better strategy encrypt the credentials using the hashing and store the hashed credentials instead of the plair credentials. You are required to build a hash function that takes the credentials and converts it to a hash ir which represents the user's name and password. Construct a server (class) that has the following: - credentials_file_path: string; where this file contains the hash_index, secret_notes_file_path for each secret note. - table: array of strings; is a hash table that contains the hashed credentials along with the file path to the user's secret notes - table_size: int; it is the size of the table which is equal to 1000000007 - server(credentials_file_path: string); is a constructor that creates credentials file if not existed or loads the credentials file into the hash table - server(); is a destructor that stores the latest hash table in the credentials file - load_credentials 0 ; this function loads the credentials into the table from the credentials_file_path. (0.5) - store_credentials 0 ; this function stores the table that is filled with the credentials into credentials file. (0.5) - hash(username: string, password: string): int; this function takes the credentials and outputs the hashed index in the table using the following equation: (1) h(S)=(i=0S1S[i]xi)modm where S[i] is the ASCII code of the i-th symbol of S,m=1000000007 and x=263. insert_secret_notes(username: string, password: string, secretNotes: string); this function stores the secret notes file path in the table. The secret notes file is generated. The file name could be user's_hashedCode.txt o Example: User's credentials hash code is 12345 so, the filename is 12345.txt - show_secret_notes(username: string, password: string); it prints the secrets on the console if the username and password are found in the table. Otherwise, it prints "Invalid credentials" - delete_secret_notes (username: string, password: string); this function deletes the record from the table if the username and password are correct and prints to "The user Secrets have been deleted", otherwise prints "Failed operation". - Implement the main function of the program to show a menu to the user that allows him to choose an action to perform and takes the necessary input from him. After performing the action, the user will be shown the same menu again. Example for the menu: Please choose an action to continue: 1. Insert secret notes // user inputs the credentials, and secret notes (1) 2. Show secret notes // user inputs the credentials (1) 3. Delete secret notes // user inputs the credentials (1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions