Re: [fpc-pascal] Readln a password

2017-01-03 Thread Bart
On 1/3/17, Tony Whyman wrote: > Today, I also came up against the problem of how to read a password from > the console without echo. With a bit of googling and code bashing, I > have created the following cross-platform code from a "getpassword" > function. > >repeat > read(c); >

Re: [fpc-pascal] Readln a password

2017-01-03 Thread Tony Whyman
On 27/11/16 17:07, Michael Van Canneyt wrote: If you mean in a cross-platform way, I think we would welcome patches :) Michael. Today, I also came up against the problem of how to read a password from the console without echo. With a bit of googling and code bashing, I have created the follo

Re: [fpc-pascal] Readln a password

2016-11-27 Thread geneb
On Sun, 27 Nov 2016, Adriaan van Os wrote: I wonder what the recommended way is to readln a password from console, as a standard Readln echoes the password. Readln is wholly unsuited to the task. You're better off writing a routine that gets input one character at a time. g. -- Proud owne

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Jonas Maebe
On 27/11/16 18:54, James Richters wrote: Shouldn't an extremely basic function like readkey be cross-platform? It is, but the crt unit only works with (almost) fully functional terminal windows, and not with redirected or piped input/output (as used by Xcode). Jonas __

Re: [fpc-pascal] Readln a password

2016-11-27 Thread James Richters
users discussions Subject: Re: [fpc-pascal] Readln a password On Sun, 27 Nov 2016, Adriaan van Os wrote: >> Dmitry Boyarintsev wrote: >> >>> I'd think you want something simlar on unix. >>> Take a look at man 4 termios >>> specifically at local flag named &qu

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Michael Van Canneyt
On Sun, 27 Nov 2016, Adriaan van Os wrote: Dmitry Boyarintsev wrote: I'd think you want something simlar on unix. Take a look at man 4 termios specifically at local flag named "ECHO". you want to disable it via tcsetattr() Â (TermIO unit) Thanks for the hint. I haven't yet tried it, but I

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
Dmitry Boyarintsev wrote: I'd think you want something simlar on unix. Take a look at man 4 termios specifically at local flag named "ECHO". you want to disable it via tcsetattr() Â (TermIO unit) Thanks for the hint. I haven't yet tried it, but I would expect it to fail,as stty (see stty.c in

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
Tomas Hajny wrote: Does the same limitation / issue apply for Keyboard.GetKeyEvent/PollKeyEvent on Mac OS X? To a lesser extent. It doesn't write "funny characters" to the Xcode Console window as "uses CRT" does, but still echoes typed characters. Like with "uses CRT", the problem doesn't occu

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
Dmitry Boyarintsev wrote: I'd think you want something simlar on unix. Take a look at man 4 termios specifically at local flag named "ECHO". you want to disable it via tcsetattr() Â (TermIO unit) Thanks for the hint. I haven't yet tried it, but I would expect it to fail, as stty (see stty.c in

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Tomas Hajny
On Sun, November 27, 2016 15:49, Adriaan van Os wrote: > James Richters wrote: >> Here is how I read passwords... it generates a random character and >> displays >> that so someone looking over your shoulder things those characters are >> the >> password >> It uses readkey which does not display on

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Dmitry Boyarintsev
On Sun, Nov 27, 2016 at 8:24 AM, Adriaan van Os wrote: > I wonder what the recommended way is to readln a password from console, as > a standard Readln echoes the password. > > 1. SetConsoleMode seems to be Windows-specific > I'd think you want something simlar on unix. Take a look at man 4 term

Re: [fpc-pascal] Readln a password

2016-11-27 Thread Adriaan van Os
James Richters wrote: Here is how I read passwords... it generates a random character and displays that so someone looking over your shoulder things those characters are the password It uses readkey which does not display on the screen, one character at a time Thanks for your reply, but please

Re: [fpc-pascal] Readln a password

2016-11-27 Thread James Richters
I would like to mention that if you store your password in a constant like this: const password='mypassword' then if someone edits your exe file with any text editor, your password will be in there as text and easy to find. I have used this method to get around this... I store a huge string

Re: [fpc-pascal] Readln a password

2016-11-27 Thread James Richters
Here is how I read passwords... it generates a random character and displays that so someone looking over your shoulder things those characters are the password It uses readkey which does not display on the screen, one character at a time Function Readpw:String; Var Pwstring : String; pwchar