學習內容:
什么是MD5?
MD5是資訊摘要演算法是第五代,也是一種被廣泛使用的密碼散列函式可以產生出一個128位的散列值,用于確保資訊傳輸完整一致,主要增強演算法復雜度和不可逆性,具體的MD5值是一樣的,
關于網路上有些MD5的破解網站的原理就是背后有一個字典,你輸入MD5加密后的值,然后他去字典里面找 找到之后就把加密之前的值反饋給你,
舉個栗子:
測驗MD5 加密
create table test(
id int(5) not null,
name varchar(20) not null,
pwd varchar(20) not null,
primary key(id)
)
插入一條資料:(這一種屬于明文密碼)
insert into test values(1,’lisi’,’123456’)
然后就可以用修改陳述句給他的密碼加密
update test set pwd=MD5(pwd) where id =1;
注意:如果不加where條件就是把所有的密碼加密,
還有一種是插入時加密:
insert into test values(2,’xiaoming’,MD5(‘123456’))
如何校驗:將用戶傳遞進來的密碼,進行md5加密,然后比對加密后的值,
select * from test where name=xiaoming and pwd=MD5(‘123456’)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/283038.html
標籤:其他
