Thread: Storing a password

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    8

    Storing a password

    I'm writing a program that is supposed to be used for educational purposes on high school/college level, and I want to password-protect some features so that only the teacher can access them.
    Now, the problem is how to save this teacher password. I guess I will have to encrypt it and write it to file when the program exits, but how do I prevent people from simply deleting this file, thus resetting the password? I could always set the filename to something strange and put it in a hard-to-find location, but this seems like a lame way of doing it.
    Thoughts on how do to this? I don't need extreme security as I don't expect anyone to put that much effort on breaking the password. I just need something that is secure enough not to be cracked during a lesson.

  2. #2
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    I guess I will have to encrypt it
    read http://www.cprogramming.com/tutorial/xor.html
    Thoughts on how do to this?
    Making it hidden would help add a little bit of protection. You could use the trick spyware people do using a dll and the registry which would probably keep it as safe as you need.

  3. #3
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Use the registry. Store the password somewhere in the computer's registry, encrypted, and with a name that doesn't directly relate to your program. This will be virtually impossible to find/alter/delete unless someone uses a registry sniffing program. In the case that the password does get erased/deleted, you can just check that and make it so you can't log in at all.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    8
    Using the registry sounds like a good idea. Thanks alot!

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, 07:20 AM
  2. Advice on storing a password
    By (TNT) in forum C++ Programming
    Replies: 2
    Last Post: 07-09-2006, 02:44 AM
  3. [Q]Hide Password
    By Yuri in forum C++ Programming
    Replies: 14
    Last Post: 03-02-2006, 03:42 AM
  4. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM
  5. password
    By hammers6 in forum C Programming
    Replies: 1
    Last Post: 10-10-2001, 12:14 AM