当前位置:网站首页>Password encryption MD5 and salt treatment
Password encryption MD5 and salt treatment
2022-06-28 04:16:00 【weixin_ forty-seven million one hundred and sixty-four thousand】
About password encryption md5 And salt treatment
md5 encryption :
When the user registers, the encrypted password is sent to the back-end storage. When logging in ,
Then match the encrypted password with the encrypted password in the database .
This encryption does not require decryption
One .md5 The in vue In the middle of the day :
1. install .
npm install js-md5 -D
2. Use .
(1) Introduced in the project md5 modular .
import md5 from “js-md5”
(2) stay main.js There will be md5 Convert to vue Prototype
import md5 from "js-md5"
Vue.prototype.$md5=md5
3. Example
<input type="number" v-model="value">
console.log(" Encrypted password :"+ this.$md5(this.value))
Two .md5 The in react In the middle of the day :
First step :
npm install js-md5, Install in the root directory of the file , The instructions are as follows
npm install --save js-md5 // Install into production environment
The second step :
introduce js-md5
At the project entrance file index.js in introduce js-md5
import md5 from 'js-md5'
Mount to react On the prototype of
React.Component.prototype.$md5 = md5
The third step :
To use... In components
import React, {
Component } from 'react'
class friend extends Component {
componentWillMount () {
let str = '123456'
let data = this.$md5(str)
console.log(data) // e10adc3949ba59abbe56e057f20f883e
}
render() {
return (
<div className="friend"> friend friend </div>
)}
}
export default friend
III. salt adding treatment
Directly analyze important data MD5 After processing , Reverse decryption is really difficult , But the flaw can still be found , If the user named LiZicheng can view the database , Then he can observe that his password is the same as that of others , that , Others use the same password as themselves , such , You can log in as someone else . So did our previous encryption methods fail to deal with this behavior ? In fact, just a little confusion can prevent , This is called... In encryption terminology “ Add salt ”. Specifically, in the original material ( User defined password ) Add other ingredients to ( Generally, it is the user's own and constant factor ), In order to increase the system complexity . When this salt is combined with the user password , Then through the summary processing , You can get more hidden summary values . See code below :
// Salt and encrypt the password , Encrypt and then pass Hibernate Save... In the database
String changedPswd = DigestUtils.md5Hex(name + pswd);
It's that simple , Salt in the above code is the user name , If you can, you can also use the email when the user registers , Registration time and other non empty information ( If it's empty, the salting process will fail ). Their actual login passwords are 123456, But you can't see it by looking at user records . Now people with ulterior motives open the database and see completely different passwords , His previous methods have failed .
边栏推荐
- leetcode:714. The best time to buy and sell stocks includes handling fee [DP dual status]
- How to write a software test report? Here comes the third party performance report template
- Reverse a stack with recursive functions and stack operations only
- RT-Thread 双向链表(学习笔记)
- With the transformation of automatic empowerment, Feihe dairy accelerates its move towards digitalization!
- What is the level 3 password complexity of ISO? How often is it replaced?
- Are the two flame retardant standards of European furniture en 597-1 and en 597-2 the same?
- Building log analysis system with elk (III) -- Security Authentication
- Lingge leangoo agile Kanban tool adds the functions of exporting card documents and pasting shared brain map nodes
- Notes to friendship chain
猜你喜欢

基于正点原子stm32的mini板的TFTLCD显示实验

云厂商为什么都在冲这个KPI?

公司领导说,个人代码超10个Bug就开除,是什么体验?

2022年中国音频市场年度综合分析

Meichuang was selected into the list of "2022 CCIA top 50 Chinese network security competitiveness"

Learning about DC-DC step-down chip of sy8120i (12V reduced to 3.3V)

有关函数模板的那些小知识-.-

抖音实战~关注博主

Notes to friendship chain

How to write a software test report? Here comes the third party performance report template
随机推荐
等保2.0密码要求是什么?法律依据有哪些?
抖音实战~取关博主
阿里P8倾情推荐,Fiddler抓包工具实战篇(一)
Another option for ERP upgrade, MES system
美创数据安全管理平台获信通院“数据安全产品能力验证计划”评测证书
Tiktok practice ~ pay attention to bloggers
Unity C # e-learning (11) -- custom protocol generation tool
成长一夏 挑战赛来袭 | 学习、创作两大赛道,开启导师报名啦!
RT thread bidirectional linked list (learning notes)
MSc 307 (88) (2010 FTPC code) Part 2 smoke and toxicity test
由两个栈组成的队列
第一个.net core MVC项目
How to learn a programming language systematically| Dark horse programmer
02 MongoDB数据类型、重要概念以及shell常用指令
Go语言学习教程(十四)
A queue of two stacks
Uncertainty principle
One article tells you what kubernetes is
Tiktok actual battle ~ take off the blogger
CDC全量抽取mysql数据时,怎么才能加快ChunkSplitter呢?