How to encrypt using the crypt () function in PHP

Source: Internet
Author: User
Tags crypt
This article mainly for you in detail the PHP use Crypt () function to encrypt, with a certain reference value, interested in small partners can refer to

One, the code

<?php  $str = ' Apply crypt () function for one-way encryption! ';     Declares the string variable $str  echo ' before encrypting the value of $str: '. $str;  $crypttostr = Crypt ($STR);      The value of the $STR encryption  Echo ' <p> encryption $str after the variable is: '. $crypttostr;  Output encrypted variable?>

Ii. Results of operation

Parameters do not have a salt, each encryption results in a different cipher.
The $STR value before encryption is: Apply the crypt () function for one-way encryption!
The value of $str after encryption is: $1$re4.gg4. $D. yd00xx0fffifp6krkgn0

Third, the Code

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 

Iv. Results of operation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.