Altera_Forum
Honored Contributor
9 years agoSimple hash algorithm
Hi guys,
I'm trying to create a hash algorithm (a very simple one) for homework exercise. I basically have taken an input from the user and hash it using: a = 1, b =2, c = 3 ... z = 26. So if the user input is abc, it will store 123. My functions for creating a username and password so far:// registering an account
void regAccount(){ cout << "Please enter your username: "; cin >> inputUsername; cout << endl; if (inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username || inputUsername == username) { cout << "Username already exists" << endl; } else { for (i = 0; i < 10; i++) { if (username == "Empty") { username = inputUsername; hashPass(); cout << "Is this account an admin? - 1 = yes / 2 = no: "; cin >> input; if (input == 1) { admin = true; } else { admin = false; } break; } } } }// hash the passwordvoid hashPass(){ cout << "Please enter your password: "; cin >> password; cout << endl; for (int j = 0; j < password.length(); j++) { // possibly a switch statement checking if password == a, b, c... } } Thanks for having a look. _____________________________________ best ringtones download (http://bestringtones.net) on this website is including all the best ringtones, the latest, most are much loved and the best quality. When you have the best ringtones, you will feel happy and comfortable.