Password Protect

This is a discussion on Password Protect within the C++ Programming forums, part of the General Programming Boards category; How would you make a password protected program, simply. I know how to use strings and if statements with strings ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    545

    Password Protect

    How would you make a password protected program, simply. I know how to use strings and if statements with strings but I dont know how to make files that are used outside of a compiler so how could you protect it so that nobody could access by just reading the source code?

  2. #2
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Save the password to an outside file, but first convert the password to binary or some kind of hash to protect it. Then when the program checks, it converts the user entered password to binary or some kind of hash and then checks that encoded password to the stored password(which is also encoded). This way you are always dealing with encoded passwords, not plain text ones.
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    545
    sounds good i just wish i understood

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    1: Make the program read a binary or hash formatted file.
    2: Encode entered password.
    3: Compare now encoded password with already encoded file text.
    4: If comparison returns false, deny access.

    (Same thing jmd15 just said.)

    What don't you understand?
    The whole thing?
    If so, you need to get more experience before trying to do what you want to do.

    BTW: Once someone has access to your source code, there is NO WAY to protect anything that your program does or has, because all they need do is decode the encrypted file the same way you do to see that password. So as I just said, you can't make your password safe, if someone has access to your source code.

    - Hope I could be of some help! -
    Last edited by Queatrix; 11-07-2005 at 03:13 PM.

  5. #5
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    What don't you understand?
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  6. #6
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    Just use fstream for writing/reading the saved file and use XOR for the encryption/decryption for the password.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading a password from a file.
    By medeshago in forum C Programming
    Replies: 15
    Last Post: 12-21-2008, 06:20 AM
  2. [Q]Hide Password
    By Yuri in forum C++ Programming
    Replies: 14
    Last Post: 03-02-2006, 02:42 AM
  3. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM
  4. Password prompt in unix w/o \b
    By rafe in forum C++ Programming
    Replies: 1
    Last Post: 10-09-2002, 08:54 AM
  5. password
    By hammers6 in forum C Programming
    Replies: 1
    Last Post: 10-10-2001, 12:14 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21