What is the Mcrypt in PHP?
Hi friends,
I have done with my basic things in PHP programing language and now I am slowly moving towards an advanced part. Now I have started with the Cryptography Extensions that are used in PHP. In that I came to know that Mcrypt is used for the encrypt or decrypt data. So please tell me what is the Mcrypt in PHP? And also tell the purpose of it.!! :notworthy
Re: What is the Mcrypt in PHP?
These functions allow access to the mcrypt library, which has a wide variety of encryption algorithms, including DES, TripleDES, Blowfish (default), 3-WAY, SAFER-sk64, SAFER-SK128, Twofish, TEA , RC2 and GOST in CBC mode, OFB, CFB and ECB. In addition, it supports RC6 and IDEA which are considered "non-free". CFB / OFB is on 8bit by default. To make sure that mcrypt doesn't fail to load when using Windows XP , Apache 2 and php 5, even if all the required procedure to install it has been accomplished already, copy libmcrypt.dll, which is normally in the php main directory, into the php\ext directory.
Re: What is the Mcrypt in PHP?
These functions use 'mcrypt. To use this library, you will have to download the file libmcrypt-xxtar.gz, which you will find on the web. Since PHP 5.0.0 you need version 2.5.6 or following the libmcrypt library. If you compile PHP with the library libmcrypt 2.4.x, the following algorithms are supported: "CAST", "LOKI97", "Rijndael" SAFERPLUS "," Serpent "and the following figures:" Enigma "(encryption) "PANAMA", "RC4" and "Wake".
Re: What is the Mcrypt in PHP?
If installing libmcrypt from RPM, you need both libmcrypt*.rpm and libmcrypt-devel*.rpm. You must compile PHP with - with-mcrypt [= DIR] to enable this extension. DIR is the mcrypt install. Make sure you compile libmcrypt with - disable-posix-threads. You can install Mcrypt from the PHP Source Tree as a module if you choose. Mcrypt.dll should be included in the WINDOWS installer of PHP. Or in the WINDOWS installer of phpmyadmin.
Re: What is the Mcrypt in PHP?
mcrypt_module_open () returns a pointer to encryption. The mcrypt_module_open, opens the module of the algorithm and method to use. The following is a description :
- resource mcrypt_module_open ($ string algorithm, string algorithm_directory, string mode, string $ mode_directory)
where,
mcrypt_module_open () opens the module of the algorithm and method to use. The name of the algorithm is specified by parameter algorithm (eg "twofish"), or a constant MCRYPT_ciphername. The library is closed by calling mcrypt_module_close ().
Re: What is the Mcrypt in PHP?
The following are the Predefined Constants, that are defined by this extension, and are only available when the extension has been compiled into PHP or dynamically loaded at runtime.
- MCRYPT_MODE_ECB (electronic codebook) is suitable for random data, such as keys. Because data are sparse and random, the disadvantages of the ECB have a favorable negative effect.
- MCRYPT_MODE_CBC (cipher block chaining) is especially useful with files whose security ECB is not sufficient.
- MCRYPT_MODE_CFB (cipher feedback) is the best mode for encrypting byte streams where single bytes must be encrypted one by one.
- MCRYPT_MODE_OFB (output feedback, in 8bit) is comparable to CFB, but can be used when errors should not be propagated.
- MCRYPT_MODE_NOFB (output feedback, in nbit) is comparable to OFB, but more secure because it operates with the block size of the algorithm.
- MCRYPT_MODE_STREAM is an additional mode to allow the use of algorithms such "WAKE" or "RC4".