String to password text
Is there by any chance a way to change a s开发者_如何学Pythontring to something like a password ie **??
the * should still have the value of the password, but just be masked.
You can't set a password string to "****"
and still have the string have the password hidden in it. But you can use the JPasswordField when you're getting passwords from a user to mask them visually (in case of prying eyes).
If you are using Swing, check out the JPasswordField class.
This is something you would do with a GUI control, rather than by changing the string directly.
Do you mean the String should be masked in-memory? I don't think that's possible. You can, however, and you should, encrypt the password as soon as possible (before sending it over the Internet, for example) and compare the encrypted value with the encrypted password in your database.
精彩评论