Password script?

I just started c++ yesterday and I practiced making a code that lets you choose a username and then enter a password and confirm it
but thats all there is to it
does anyone have any suggestions on how i could improve this? or could anyone possibly show me how to make it remember multiple usernames and passwords at once? like so a bunch of people could have their own login info,
and i know it probably sucks, im really new to this and its pretty confusing stuff to me :p


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 #include <iostream>
#include <string>
using namespace std;

int main()
{
string Password;
string password;
string UserName;
    cout << "Please enter a username. \n";
    getline ( cin, UserName, '\n');
    cout << "Please enter your password.\n";

    getline (cin, password, '\n');

    cout << "Please enter your password again. \n";

    getline( cin, Password, '\n');

 if ( Password == password)
    {
        cout << "Welcome, "  << UserName << "\n";
    }
    else
    {
        cout << "Sorry, try again." << "\n";
        return 0;
    }
}

you're not gonna use that in a login interface, are you !!!
i think you should learn more about files in c++.

http://www.cplusplus.com/doc/tutorial/files/

when you've finished, read something about cryptography:
after you get a deep understanding of encryption, try using this md5 source in your program:

http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5

i didn't read the source, and not responsible of the circumstances of using it.

you should store your passwords in a file and encrypted by your program.
when a login attempt occurs, your program hashes the input password and compares it with the hash stored in the file.
if there's a match, then the user is allowed access.
well I wasnt planning on using it for any actual login stuff, it was just to practice a little, but thank you i will definately check those both out and see if they can help! thanks :D
Topic archived. No new replies allowed.