MCrypt encoding function library: mcrypt_get_cipher_name

Source: Internet
Author: User
Keywords mcrypt mcrypt_get_cipher_name php Chinese function manual coding function Library
Tags aliyun code coding coding function library content data function function library

Mcrypt_get_cipher_http://www.aliyun.com/zixun/aggregation/11696.html ">name

Gets the name of the encoding.

Syntax: string mcrypt_get_cipher_name (int cipher);

return value: String

Function type: Encoding processing

Content Description

This function is used to obtain the name of the encoding. The return value is the name string and returns False or the name entered if no encoding is specified.

Usage examples

The following example outputs the TripleDES string.

<?php
$cipher = Mcrypt_tripledes;
Print Mcrypt_get_cipher_name ($cipher);
?>

To use this function library to prepare the MCrypt program, you can download the program to Ftp://argeas.cs-net.gr/pub/unix/mcrypt libmcrypt-x.x.tar.gz. At the same time in compiling PHP program needs to add--with-mcrypt options, so that the function library to operate smoothly.
This function provides the encoding of DES, TripleDES, Blowfish (default), 3-way, safer-sk64, safer-sk128, Twofish, tea, RC2, and the use of CBC, OFB, CFB, and ECB for password retrieval GOST. In addition, RC6 and idea are not free coding methods. See listed below as defined passwords:

Mcrypt_blowfish
Mcrypt_des
Mcrypt_tripledes
Mcrypt_threeway
Mcrypt_gost
Mcrypt_crypt
Mcrypt_des_compat
Mcrypt_safer64
mcrypt_safer128
mcrypt_cast128
Mcrypt_tean
Mcrypt_rc2
Mcrypt_twofish (before MCRYPT 2.x version)
mcrypt_twofish128 (MCRYPT 2.x version)
mcrypt_twofish192
mcrypt_twofish256
Mcrypt_rc6
Mcrypt_idea

In the area of password retrieval (cipher), this library supports four cipher searches of CBC, OFB, CFB and ECB. The simple description of these four cipher searches is as follows, please refer to Schneier's Applied Cryptography (ISBN:0-471-11709-9) For more detailed information:

ECB (Electronic codebook): Suitable for random data, such as using another key. Using the ECB is less appropriate if the volume of data is small and random.
CBC (cipher block Chaining): For file encryption, security is better than the ECB.
CFB (cipher feedback): Suitable for encrypting a segment of independent bit data (single bytes) in a bit-group stream.
OFB (output feedback): Compatible with CFB, especially for applications that cannot tolerate error ripple.
PHP is still unable to encrypt the unit (bit) entropy to decrypt the steps, currently only suitable for the string for password processing.

When using the two modes of CFB and OFB, vector initialization (initialization vector, IV) is required, and the CBC mode can also be initialized using vectors. The value of the vector initialization must be unique and remain the same while decrypting. When the data output is encrypted, the password key can also be output simultaneously (for example, in a file), or the value initialized by the vector can be exported with the encrypted data.

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.