- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
Lien copié
1 Répondre
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hello
for (int i=0;i<strlen(username);i++) { username=username-'a'+1; } Best regards Johi
Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable