Mcrypt function library application in PHP

xiaoxiao2021-03-06  88

The four block password modes of Mcrypt are:

· Electronic Codebook (ECB, E-Code): This mode is used to encrypt short disorderly data, such as key; Cipher Block Chaining (CBC, Password Block Chain): The security level of this mode is higher than ECB; · Cipher Feedback (CFB, password feedback): This mode is used to encrypt byte streaming; • Output feedback (OFB, output feedback): This mode is similar to the CFB mode, but it can be used to tolerate erroneous reproduction issues Program, this mode is run in 8-bit mode, has proven to be unsafe.

If you are the latest version of the Mcrypt library, then Mcrypt can also use more secure block patterns and run in Tream mode, including: • Ooutput feedback (NOFB): This mode is similar to the OFB mode, but its security is higher. Because it is running in a single block (N), it is not running in a single bit; • Stream Mode: is an additional mode, which can support streaming algorithms, such as Wake and RC4.

Here is only the syntax of the CBC:

String Mcrypt_CBC (String Cipher, String Key, String Data, INT MODE)

The function has 4 parameters. The first cipher represents an algorithm for data encryption. The second key is the key (key) provided by the algorithm, the third DATA is encrypted, and the last Mode details the data. Is it encrypted or decrypted. The algorithms supported by the Mcrypt library include: DES and Triple-des · Blowfish · Twofish · Safer-Sk64 · 3-Way · RC2 · GOST · RC6 · RC4 · Cast · Idea · AES Download Mcrypt Function External Library (Version: 2.5.7 )

http://club.phpe.net/index.php?s=post/ind =attach &type=post&osc=28237 (I do the compressed package, including external library functions, installation methods and one PHP function written)

Or to the address provided by the official website of the PHP to download:

http://ftp.emini.dk/pub/php/win32/mcrypt/

Encryption algorithm supported by this version:

CAST-128 GOST RIJNDAEL-128 Twofish Arcfour Cast-256 Loki97 Rijndael-192 Saferplus Wake Blowfish-Compat des Rijndael-256 Serpent Xtea Blowfish ENIGMA RC2 TrIPLEDES

Supported encryption mode:

CBC CFB CTR ECB NCFB NOFB OFB STREAM

installation method

1. Copy libmcrypt.dll to the System32 directory 2. Remove; extension = php_mcrypt.dll front semicolon

Restart Apache or IIS

I only use CBC mode, other reference php official website

http://www.php.net/manual/en/ref.mcrypt.php

Mcrypt function:

//Instructions

$ Password = Mcrypt ($ _ post ['password'])

?>

转载请注明原文地址:https://www.9cbs.com/read-122490.html

New Post(0)