当前位置:网站首页>MD5 & MD5 salt value encryption
MD5 & MD5 salt value encryption
2022-07-22 12:53:00 【Study hard and love you hard!】
Introduction and features
Md5
- Message Digest algorithm 5, Information digest algorithm
- compressibility : Any length of data , To calculate the Md5 The length of the value is fixed ;
- Easy to calculate : From the original data Md5 Value is easily ;
- Resistance to change : Make any changes to the source data , Even if only one byte is modified , What you get MD5 Value is easily .
- Strong impact resistance : I want to find two different data , Make them have the same Md5 value , It's very difficult .
Add salt
- By generating random numbers and Md5 Generating strings to combine
- The database also stores Md5 Value jade salt value , Verify the correctness of using salt Conduct Md5 that will do .
Use recommend BCryptPasswordEncoder
@Test
public void md5Test() {
//org.apache.commons.codec.digest
// Due to resistance to modification So it can be violent Crack Rainbow watch therefore MD5 Direct encryption is not possible
DigestUtils.md5Hex("123456");
// Salt value encryption : Random value Format $1$+8 Bit character
// For example, add the current system time For subsequent verification, you need to save the system time You can encrypt the comparison again during verification
Md5Crypt.md5Crypt("123456".getBytes(),"$1$88888888");
// Coder springsecurity We no longer need to store salt value , Matching will automatically resolve the salt value
BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
// code Different every time
String encode = bCryptPasswordEncoder.encode("123456");
// Verify the match
bCryptPasswordEncoder.matches("123456",encode);
}
Author's statement
If there is a problem , Welcome to correct !
边栏推荐
- 微软SDL 2022年最新版学习笔记
- Codeforces Round #806 (Div. 4)
- requests库中使用response.json()报错:json.decoder.JSONDecodeError: Expecting value
- Ylarn causal learning open source project "contributor program" is coming!
- 数据类型与变量
- What are the characteristics of ball screen projection with different implementation methods
- Niuke - Huawei question bank (91~100)
- 华为无线设备配置攻击检测功能
- 防患于未然是最好的解决勒索软件方法
- 121. 买卖股票的最佳时机
猜你喜欢
Use response in the requests library Json() error: json decoder. JSONDecodeError: Expecting value
等额本金和等额本息还款方式的差异分析
多功能嵌入式解码软件(2)
Ylarn causal learning open source project "contributor program" is coming!
C语言指针详解
[2022 national games simulation] minimum spanning tree - Kruskal, matrix, tree section dynamic DP
OAuth2.0
New energy_ Photovoltaic inverter
Analysis on DNS domain name hijacking of mobile terminal in IM instant messaging development
2022.07.18
随机推荐
80% 应聘者都不及格的 JS 面试题
Qgraphicsview graphic view framework uses (VI) primitive animation
PHP json_ Decode usage
OAuth2.0
Prefix and & difference
Alibaba cloud technology expert Yang Zeqiang: building observable capabilities on elastic computing cloud
STM32 FSMC的应用笔记
97页数字孪生赋能的智慧园区物联网云平台建设方案
How to seize opportunities in the meta universe
Pychart configuration in Anaconda environment
121. The best time to buy and sell stocks
lapsus盗取微软bing源代码的详细分析过程
121. 买卖股票的最佳时机
Anaconda环境下Pycharm的配置
国际各国数据安全面临的现状是怎样的
The basic knowledge of K-line diagram occupies an important position
Multifunctional embedded decoding software (2)
SIM卡交换方案的工作原理
[PHP environment setup /wamp/ interpreter / download]
防患于未然是最好的解决勒索软件方法