Summary of usage of PHP encryption extension MCrypt

Source: Internet
Author: User
Tags crypt php language mcrypt sha1
The PHP language comes with a lot of encryption and decryption methods and extensions, and today we present one of the extensions MCryptExtension, the MCrypt extension completes the encapsulation of common cryptographic algorithms. In fact, the extension is the MCrypt Standard Class library encapsulation, MCrypt completed a considerable number of commonly used cryptographic algorithms, such as DES, TripleDES, Blowfish (default), 3-way, safer-sk64, safer-sk128, Twofish , TEA, RC2 and GOST encryption algorithms, and provides a model of CBC, OFB, CFB, and ECB four block encryption. This article summarizes how the MCrypt extension is used.

How to use MCrypt extensions

1. PHP Encryption Extension Library-mcrypt extension Library instance Usage

Before beginning the text of this article, let's look at what is the PHP encryption Extension Library: PHP is not only a few cryptographic functions (MD5,CRYPT,SHA1), in addition to PHP, there are some more comprehensive encryption extension library! Just like PHP does not support the operation of a certain function, but in the new version of this would like to provide support, it is provided in an extended manner, so that when we configure PHP, if we do not use this feature, we can let PHP do not load him. This saves server resources. provides its performance.

2. Specific introduction to PHP encryption extension MCrypt basic use

Mcrypt supports the following four types of block cipher modes: CBC, OFB,CFB and ECB. If you use libmcrypt-2.4.x or later links, you can also support NOFB grouping mode and streaming mode. The following are the supported cryptographic modes and their corresponding predefined constants.

3. Use apt-get install PHP extension Library mcrypt, Curl, GD under Ubuntu

Ubuntu package download, installation tools: Apt-get is very useful, and Ubuntu's software source provides most of the commonly used packages, so it is very simple to install PHP extension Library mcrypt, Curl and GD library under Ubuntu, You can do this automatically by entering the following command (the system has PHP5 installed)

4. How to resolve PHP load Mcrypt.dll failure

PHP Load Mcrypt.dll Failure Solution: 1, php.ini inside find Extension=php_mcrypt.dll, remove the front semicolon ";", restart Apache. Invalid (Note: PHP.ini in the Appserv in the Dinwos directory). 2, copy the PHP directory under Libmcrypt.dll to windows/system32 directory, restart IIS, invalid. 3, another method, the Libmcrypt.dll copy to the Apache Bin directory, the effective.

5. PHP MCrypt reversible Encryption Algorithm analysis

The status of data encryption in our lives has become increasingly important, especially given the large amount of data that is being traded and transmitted over the network. For information that does not need to be restored to the original data we can encrypt the data using an irreversible encryption algorithm such as MD5, SHA1, but important information such as transactional information that needs to be restored to the original data must be encrypted using a reversible encryption algorithm. Of course you can write a reversible encryption algorithm to encrypt and decrypt the computation yourself. In this article we describe the use of the MCrypt module for cryptographic decryption operations.

6. phpMyAdmin appears unable to load the mcrypt extension, please check the PHP configuration workaround

MySQL database is not installed properly, MySQL related service is not started in system service (see How to install MySQL correctly)

The Libmcrypt.dll file is missing from the system's System32 (C:\windows\system32) directory, and the workaround is to locate the Libmcrypt.dll in the PHP directory and copy the Libmcrypt.dll to C:\windows \system32 directory, and then restart the Web service.

Related questions

1. Linux Installation mcrypt PHP extension encountered the following problems, how to solve it?

2. Open the Mcrypt PHP extension

4. Enable Php-mcrypt issues?

"Recommended"

1. "PHP encryption and decryption class library" 10 PHP encryption and decryption class library download

2. PHP Chinese Web free video tutorial: "Php.cn lonely Nine Cheap (4)-php video Tutorial"

3. Summary of cryptographic usages of PHP function crypt ()

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.