若依框架从后台查询回来的密码是明文如何展示为***
时间: 2023-07-23 14:09:23 浏览: 34
您可以使用字符串替换的方法将明文密码替换为星号,例如使用 Python 代码可以实现:
```python
password = "your_password" # 明文密码
password = "*" * len(password) # 将密码替换为相同数量的星号
print(password) # 打印替换后的密码
```
这样就可以将明文密码展示为星号了。当然,实际应用中更安全的方式是将密码加密存储,不应该以明文形式存储密码。
相关问题
Android EditText 密码框默认是小圆点 怎么改成其它的(*)
要将 Android EditText 密码框默认显示的小圆点改为其它字符,可以通过设置 EditText 的 inputType 属性来实现。
在 XML 布局文件中设置:
```
<EditText
android:id="@+id/password_edittext"
android:inputType="textPassword"
...
/>
```
在 Java 代码中设置:
```
EditText passwordEditText = findViewById(R.id.password_edittext);
passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
passwordEditText.setTransformationMethod(new PasswordTransformationMethod(){
@Override
public CharSequence getTransformation(CharSequence source, View view) {
return new PasswordCharSequence(source);
}
});
private class PasswordCharSequence implements CharSequence {
private CharSequence mSource;
public PasswordCharSequence(CharSequence source) {
mSource = source;
}
public char charAt(int index) {
return '*';
}
public int length() {
return mSource.length();
}
public CharSequence subSequence(int start, int end) {
return mSource.subSequence(start, end);
}
}
```
在上述代码中,我们设置了 EditText 的 inputType 为 textPassword,然后使用 PasswordTransformationMethod 将输入框中的文本替换为 * 号。当用户在输入框中输入内容时,实际上是输入的明文,但是在界面上会被替换为 * 号。
这样设置后,输入框中输入的密码就会被替换为 * 号。
CSDN 密码是明文存储吗
作为 AI 语言模型,我无法确认 CSDN 是否以明文形式存储密码。但是,无论是 CSDN 还是任何其他网站,密码都应该进行加密和哈希处理,以确保用户的密码安全。这是一项基本的安全措施,以保护用户的个人信息和账户安全。如果您对 CSDN 的密码安全存在疑虑,建议您联系 CSDN 官方客服或技术支持寻求帮助。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)