Thread: A Stable Password Protection Program Like Facebook (Best Run in Turbo C++ 3.1)

  1. #16
    Registered User DevoAjit's Avatar
    Join Date
    Jun 2011
    Location
    Ludhiana, Punjab, India, India
    Posts
    32
    Quote Originally Posted by gardhr View Post
    Sorry, your program is neither stable nor secure
    I know this is not secure, Please tell me some tips to make it secure. And i want to know when this programs runs, it makes a file by taking username, but the file is visible to everybody. any body can make this type of user file and can break the security. But what to do to make it secure.

  2. #17
    Registered User DevoAjit's Avatar
    Join Date
    Jun 2011
    Location
    Ludhiana, Punjab, India, India
    Posts
    32
    Quote Originally Posted by memcpy View Post
    Don't use numbers for character constants. I have no idea what "13" represents in the getch loop.
    So what can i use for Enter Key (return Key). I used ASCII value of enter key.

    Quote Originally Posted by memcpy View Post
    Don't compare with a getc loop because it's very inefficient. Read everything into a buffer and strcmp().
    How can I read into a buffer.
    Quote Originally Posted by memcpy View Post
    If you're expecting security, why are you writing the passwords to an unencrypted file?
    Yes, Its my main problem in this program. I don't know how to make a encrypted file. I searched on net, but didn't get any solution. Please tell me how to do it. Thanks memcpy.

  3. #18
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by DevoAjit View Post
    So what can i use for Enter Key (return Key). I used ASCII value of enter key.
    Use '\n' for the character generated by the return key. It will work regardless of whether your system uses an ASCII character set or not.

    Quote Originally Posted by DevoAjit View Post
    How can I read into a buffer.
    There are many ways. One way is to use getc() in a loop, appending the return value each time to the end of a buffer. Another way involves using the fgets() function, which is more line oriented. Regardless of technique, you need to ensure your code prevents input going outside your allocated buffer. (i.e. don't try to write 10 characters to a buffer that is only 5 characters long).

    Quote Originally Posted by DevoAjit View Post
    Yes, Its my main problem in this program. I don't know how to make a encrypted file. I searched on net, but didn't get any solution. Please tell me how to do it. Thanks memcpy.
    You gave up too soon. Try googling for "file encryption library".

    Generally, you don't create an encrypted file in any special way (unless the data, when encrypted, contains binary data which means you need to open the file in binary mode). You create a file as normal, and then encrypt the data before writing it to the file. To read an encrypted file, read from the file and feed the data through an appropriate decryption before using int.

    Some encryption libraries may provide special functions for opening and closing files. But, apart from alignment of files with buffers, that is just window dressing over the basic mechanics.
    Last edited by grumpy; 04-14-2012 at 10:18 PM.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #19
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Modern compilers to consider

    Free Developer Tools - Visual Studio 2010 Express | Microsoft Visual Studio
    smorgasbordet - Pelles C
    Code::Blocks

    In fact, download them all and see how you get on with each one.
    One useful test to see if you've written a good program is to get it to compile and work using multiple compilers.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. password protection programme
    By meharsri in forum C Programming
    Replies: 2
    Last Post: 02-27-2011, 06:01 PM
  2. Replies: 2
    Last Post: 01-07-2009, 10:35 AM
  3. password protection for xml file
    By anil_beloved in forum Windows Programming
    Replies: 0
    Last Post: 06-27-2005, 08:44 AM
  4. Best software copy protection program
    By axr0284 in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 12-09-2004, 09:07 AM
  5. Screen program protection?
    By biosninja in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 09-10-2002, 11:48 PM

Tags for this Thread