当前位置:网站首页>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 ,不用说了吧。都应该能懂!!!
边栏推荐
- hackmyvm-random walkthrough
- GreenOptic: 1 vulnhub walkthrough
- Google Hacking
- hackmyvm: kitty walkthrough
- 强化学习笔记:DDPG
- Turn trendsoft/capital amount of Chinese capital library
- 云安全笔记:云原生全链路加密
- How to calculate the distance between two points on the earth (with formula derivation)
- v-bind usage: class dynamic binding object array style style and function method
- 利用cookie获取admin权限 CTF基础题
猜你喜欢

Cookie is used to collect the admin privileges CTF foundation problem

(1) print()函数、转义字符、二进制与字符编码 、变量、数据类型、input()函数、运算符

hackmyvm-random walkthrough
![[sebastian/diff] A historical change extension library for comparing two texts](/img/c7/ea79db7a5003523ece7cf4f39e4987.png)
[sebastian/diff] A historical change extension library for comparing two texts

laravel 查询数据库获取结果如何判断是否为空?

File upload vulnerability

Alfa: 1 vulnhub walkthrough

财产清查概述、 全面清查的情况、局部清查的情况、财产清查的方法、财产清查结果的处理

ES6 array extension methods map, filter, reduce, fill and array traversal for…in for…of arr.forEach

最简单的FRP内网穿透教程
随机推荐
SATA M2 SSD 无法安装系统的解决方法
How to calculate the distance between two points on the earth (with formula derivation)
CTF introductory notes ping
会计凭证概述、原始凭证、原始凭证的种类、原始凭证的基本内容、原始凭证的填制要求、原始凭证的审核
SQL注入(6)
VIKINGS: 1 vulnhub walkthrough
如何一步一步的:玩转全民拼购!
4. PHP array and array sorting
加密数字货币前传:从大卫·乔姆到中本聪
对账、结账、错账更正方法、划线更正法、红字更正法、补充登记法
一个网络安全小白鼠的学习之路—nmap高级用法之脚本使用
hackmyvm: may walkthrough
file contains vulnerabilities
17. JS conditional statements and loops, and data type conversion
Praying: 1 vulnhub walkthrough
How to determine the direction based on two coordinate points on the map
利用cookie获取admin权限 CTF基础题
(3) string
Sensitive information leakage
pytorch:保存和加载模型