mask password in c# console application?

  • Thread starter Thread starter Yang
  • Start date Start date
Y

Yang

Hi
Is it possible to mask console input in a c# console application?
What I mean is: if I entered string "test" in the console, it'll echo
"****"(or nothing) instead of the string "test".

I've tried setting the foregroud color of the console the same as the
backgroud color through native API, but it doesn't really hide the password,
actually, users can manually change the foregroud color in a windows console
window, or they can copy the password from the right place of the screen
directly even they do not 'see' it. Is there a better way to do it?

thanks
Yang Liu
 
Back
Top