Summary of encryption usage of php function crypt ()

Source: Internet
Author: User
Tags crypt
There are many encryption functions in php functions, one of which can implement data encryption functions is called the crypt () function. The crypt () function uses a one-way algorithm without corresponding decryption functions. It returns a string encrypted using the DES, Blowfish, or MD5 algorithm. There are a lot of encryption functions in php functions, one of which can implement the data encryption function is called Crypt ()Function. The crypt () function uses a one-way algorithm without corresponding decryption functions. It returns a string encrypted using the DES, Blowfish, or MD5 algorithm. On the surface, the crypt () function seems useless, but it is indeed widely used to ensure the integrity of the system password. Because, even if the one-way encryption password falls into the hands of a third party, it is useless because it cannot be restored to plain text. Next we will summarize the use of the crypt () function, hoping to help you learn php.

Crypt () functions

1. example of encryption usage of the PHP encryption function-crypt () function

Print "My system salt size is:". CRYPT_SALT_LENGTH;

4. use crypt () in PHP for user authentication

The crypt () function returns a string encrypted with DES, Blowfish, or MD5. In different operating systems, the behavior of this function is different. some operating systems support more than one algorithm type. During installation, PHP checks what algorithms are available and used. Anyone who has experience using a non-Windows platform may be familiar with crypt (). This function is called one-way encryption and can encrypt some plain codes, however, the password cannot be converted to the original plaintext.

5. function introduction of PHP function crypt ()

In the PHP function crypt (), the encrypted passwords correspond to kent, banner, and parker. Note the first two letters of each password. this is because the following code is used, create interference strings based on the first two letters of the password. I will use Apache password-answer authentication configuration to prompt the user to enter the user name and password. a little-known information about PHP is, it recognizes the username and password entered by the Apache password-response system as $ PHP_AUTH_USER and $ PHP_AUTH_PW. These two variables are used in the authentication script.

Related Q &

1. what is the problem with laravel5.2 openssl_encrypt?

2. md5-PHP: crypt () function. Can the encrypted password value be equal to the salt value?

3. how to implement the PHP crypt () function in Nodejs

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.