当前位置:网站首页>PHP hash加密与解密
PHP hash加密与解密
2022-08-02 03:26:00 【陌潇】
几年前用的 md5 和加盐的加密方式都比较容易破解。今天做用户登录注册的时候遇到了hash加密的问题,顺便记录一下。
第一、加密
用到 password_hash() 函数:简单使用
//PASSWORD_DEFAULT 加密算法,目前是60位字符,官网说php的更新可能会变化的更长,多以存储的时候最好255
//123456 为需要加密的字符串
password_hash('123456',PASSWORD_DEFAULT);
第二、解密
加密倒是挺简单的,想要取出来用的时候发现没有解密的方法,找了半天也没有找到,应该是没有解密的办法,说是有个一对比的方法:password_verify()
//123456为用户输入的明文密码
//$password 这个则为加密后的60位
$password = '$2y$10$GDoAkNDzomsI5sbx.UpVh.FOMTwJqahuVNd9RcmMbCtLfPe3vr3kW';
password_verify('123456',$password );
这个方法返回 true 或 false ,不用说了吧。都应该能懂!!!
边栏推荐
- CSRF (Cross Site Request Forgery)
- php函数漏洞总结
- 真·杂项:资本论阅读笔记(随缘更新)
- cmake安装到指定目录
- 超级云APP,陪伴您一起成长的软件
- (1) print()函数、转义字符、二进制与字符编码 、变量、数据类型、input()函数、运算符
- PHP实现搜索框的自动反查提示
- The learning path of a network security mouse - the basic use of nmap
- VIKINGS: 1 vulnhub walkthrough
- 2. PHP variables, output, EOF, conditional statements
猜你喜欢

账务处理程序、记账凭证账务处理程序、汇总记账凭证账务处理程序、科目汇总表账务处理程序、会计信息化概述、信息化环境下会计账务处理的基本要求(此章出1道小题)

How to determine the direction based on two coordinate points on the map

ES6 three-dot operator, array method, string extension method

(3) 字符串

Kali环境下Frida编写脚本智能提示

(1) the print () function, escape character, binary and character encoding, variables, data type, the input () function, operator

不懂“赚钱逻辑”,你永远都是社会最底层(广告电商)

Orasi: 1 vulnhub walkthrough

元宇宙是一个炒作的科幻概念,还是互联网发展的下半场?

hackmyvm-random walkthrough
随机推荐
(3) string
cmake安装到指定目录
Warzone: 3 (Exogen) vulnhub walkthrough
The CTF introductory notes of SQL injection
账务处理程序、记账凭证账务处理程序、汇总记账凭证账务处理程序、科目汇总表账务处理程序、会计信息化概述、信息化环境下会计账务处理的基本要求(此章出1道小题)
PHP deserialization vulnerability
The roll call system and array elements find maximum and minimum values for sorting of objects
CSRF(跨站请求伪造)
The CTF introduction of PHP file contains
战场:3(双子叶植物)vulnhub走读
Eric靶机渗透测试通关全教程
2. PHP variables, output, EOF, conditional statements
Smart Tips for Frida Scripting in Kali Environment
命令执行漏洞
hackmyvm: controller walkthrough
二舅为什么能刷屏?这三件事对企业公关的启示
英语每日打卡
库存现金、现金管理制度、现金的账务处理、银行存款、银行存款的账务处理、银行存款的核对
SQL注入(6)
敏感信息泄露