How to use crypt() function for encryption in php

墨辰丷
Release: 2023-03-27 09:54:01
Original
1410 people have browsed it

This article mainly introduces in detail the use of crypt() function for encryption in PHP, which has certain reference value. Interested friends can refer to it

1. Code

加密后$str的值为:'.$crypttostr; //输出加密后的变量 ?>
Copy after login

2. Running results

Parameters without salt are encrypted each time The resulting ciphertexts are all different.
The value of $str before encryption is: apply the crypt() function for one-way encryption!
The value of $str after encryption is: $1$Re4.Gg4.$D.yd00xX0fFfIfp6KrKGN0

3. Code

    使用crypt函数进行数据验证  

用户名:
密码:
0){ echo "用户登录成功。"; }else{ echo "用户登录失败!"; } }else{ echo "请认真填写用户名和密码!"; } ?>
Copy after login

4. Running results

Related recommendations:

PHP’s more secure password encryption mechanism BcryptDetailed graphic explanation

When decoding the mini program, php 7.0 or above mcryptThe expansion cannot use the old version of the decryption solution

PHP password encryption mechanism BcryptDetailed explanation

The above is the detailed content of How to use crypt() function for encryption in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!