- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
for (int i=0;i<strlen(username);i++) { username=username-'a'+1; } Best regards Johi![](/skins/images/7FC17B7B85029576C25F1E43CE255B51/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page