|
| |||||||||
| Tags: admin, hide, password |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Hide password in C
I have a little problem I use code which is given below to check in software that someone login with admin id I would just hide the password when entering how do I do? Code: verifAdmin int ()
(
char username [100];
char password [100];
puts ( "\ n Please enter your username");
FFL;
gets (username);
if (strcmp (identifier, "foo") == 0)
(
puts ( "\ n Please enter the password");
FFL;
gets (password);
if (strcmp (password, "bar") == 0)
(
CLS;
puts ( "\ n \ n \ n");
puts ( "\ n Welcome Administrator you will be redirected in 2 seconds");
sleep (2);
return 1;
)
else
(
puts ( "\ n sorry you are not administrator");
return 0;
)
)
else
(
puts ( "\ n sorry you are not administrator");
return 0;
)
) |
|
#2
| |||
| |||
| Re: Hide password in C
Never use gets (). As it is impossible to know in advance how many characters will be read by gets (), and it will write all the characters read, even if they fall outside the buffer, this function is extremely dangerous to use. We have already used this failure to create security holes. ALWAYS USE fgets () instead of gets (). |
|
#3
| ||||
| ||||
| Re: Hide password in C
At the beginning of the program, call the necessary functions to initialize the library: initscr, cbreak. Code: while ((c = getch ())! = '\ n' & & n <len - 1) (
if (! iscntrl (c)) (
buffer [n + +] = c;
if (mask! = 0)
addch (mask);
)
)
buffer [n] = '\ 0';
addch ( '\ r');
addch ( '\ n'); |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Hide password in C" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| After updating McAfee Security Center Password Vault has ERASED all password | Marquise | Networking & Security | 6 | 06-11-2011 12:22 AM |
| Windows 7 Starter: Hide router's password | mahaFEB | Networking & Security | 4 | 08-01-2011 10:16 PM |
| *!NOT your usual Vista Password Problem - Incorrect Password even every time even after resetting | fvuong | Vista Help | 9 | 27-10-2010 02:30 PM |
| Auto-Hide toolbar won't hide? | Geoff from LA | Vista Help | 8 | 18-10-2009 07:52 AM |
| backup to a network drive is asking for username and password...whatusername and password? | Lisa Hetherington | Vista Help | 7 | 04-02-2008 09:05 PM |