BCryptPasswordEncoder()
时间: 2024-01-13 09:40:06 浏览: 84
Spring security BCryptPasswordEncoder密码验证原理详解
5星 · 资源好评率100%
BCryptPasswordEncoder()是Spring Security中的一个密码加密方法。它使用BCrypt算法对密码进行加密和验证。BCryptPasswordEncoder采用SHA-256随机盐密钥对密码进行加密,SHA是一种安全哈希函数,它是一种单向密码体制,即它是一个从明文到密文的不可逆的映射。BCryptPasswordEncoder提供了encode和matches方法,encode方法用于加密密码,matches方法用于解密/匹配密码。尽管通过encode方法加密的密码是不可逆的,但通过matches方法可以将输入的密码与数据库中的密码进行匹配,如果hash值相同,则说明是同一个密码。所以可以使用BCryptPasswordEncoder()来对密码进行加密和验证。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* [加密算法---BCryptPasswordEncoder的使用及原理](https://blog.csdn.net/weixin_43811057/article/details/128942965)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *2* [BCryptPasswordEncoder 加密算法解析](https://blog.csdn.net/qq_19922839/article/details/125261130)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
- *3* [BCryptPasswordEncoder加密](https://blog.csdn.net/superxmh/article/details/118497296)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文