String function library: Crypt

Source: Internet
Author: User
Keywords crypt php Chinese Function Handbook
Tags aliyun code function function library html http php php chinese function handbook

Crypt

(PHP3, PHP4)

Crypt---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Using DES to 碥 strings

Syntax: String crypt (String str [, string salt])

Description:

Crypt () will encode the string using standard Unix des encryption, parameter STR is the string to encode, and the parameter salt is the encrypted base (base).

If no parameter salt is provided, it will be generated arbitrarily by PHP.

Some operating systems provide more than one form of encryption, in fact, 8630.html "> Sometimes standard des encryption is replaced by MD5 encryption algorithms." The encrypted form is dependent on the parameter salt, and when installed, PHP determines the ability of the Crypt function and accepts the salt as another encryption form, and if no salt,php preset is provided it automatically produces a standard 2-character DES salt, Unless the system-preset encryption type is MD5, any md5-compatible salt is produced in this case. PHP sets a constant name Crypt_salt_length, which tells you whether a regular 2-character salt applies to your system, or you can use 12-char MD5 salt.

Whether the crypt () function provides a variety of cryptographic forms on the system, the following constants are set to 0 or 1 depending on whether the given form is available.

Crypt_std_des-Standard DES encryption and 2-char SALT

Crypt_ext_des-Extended DES encryption and 9-char SALT

CRYPT_MD5-MD5 encryption and 12-char SALT start as $1$

Crypt_blowfish-Extended des encryption and 16-char SALT start as $2$

Reference: MD5

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.