From 0a5570fffaa31657fe16c17e73551fbe6f50f29d Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy Date: Mon, 22 Jul 2002 16:58:08 +0000 Subject: [PATCH] Adding constants, new structure applied git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@89494 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mcrypt/constants.xml | 135 +++++++++++++++++++++++++++++++ reference/mcrypt/reference.xml | 141 +++++++++++---------------------- 2 files changed, 182 insertions(+), 94 deletions(-) create mode 100644 reference/mcrypt/constants.xml diff --git a/reference/mcrypt/constants.xml b/reference/mcrypt/constants.xml new file mode 100644 index 0000000000..046070c0af --- /dev/null +++ b/reference/mcrypt/constants.xml @@ -0,0 +1,135 @@ + + +
+ &reftitle.constants; + &extension.constants; + + Mcrypt can operate in four block cipher modes (CBC, OFB, CFB, and + ECB). If linked against libmcrypt-2.4.x or higher the functions can also operate + in the block cipher mode nOFB and in STREAM mode. Below you find a list + with all supported encryption modes together with the constants that are + defines for the encryption mode. For a more complete reference and + discussion see &book.applied.cryptography;. + + + + MCRYPT_MODE_ECB (electronic codebook) is suitable for random data, + such as encrypting other keys. Since data there is short and random, + the disadvantages of ECB have a favorable negative effect. + + + + + MCRYPT_MODE_CBC (cipher block chaining) is especially suitable for + encrypting files where the security is increased over ECB + significantly. + + + + + MCRYPT_MODE_CFB (cipher feedback) is the best mode for encrypting byte + streams where single bytes must be encrypted. + + + + + MCRYPT_MODE_OFB (output feedback, in 8bit) is comparable to CFB, but + can be used in applications where error propagation cannot + be tolerated. It's insecure (because it operates in 8bit + mode) so it is not recommended to use it. + + + + + MCRYPT_MODE_NOFB (output feedback, in nbit) is comparable to OFB, but + more secure because it operates on the block size of the algorithm. + + + + + MCRYPT_MODE_STREAM is an extra mode to include some stream algorithms + like WAKE or RC4. + + + + + + + Some other mode and random device constants: + + + + MCRYPT_ENCRYPT + (integer) + + + + + + + + + + MCRYPT_DECRYPT + (integer) + + + + + + + + + + MCRYPT_DEV_RANDOM + (integer) + + + + + + + + + + MCRYPT_DEV_URANDOM + (integer) + + + + + + + + + + MCRYPT_RAND + (integer) + + + + + + + + + +
+ + diff --git a/reference/mcrypt/reference.xml b/reference/mcrypt/reference.xml index 9bb0e4814d..20347ae5c5 100644 --- a/reference/mcrypt/reference.xml +++ b/reference/mcrypt/reference.xml @@ -1,27 +1,29 @@ - + Mcrypt Encryption Functions mcrypt - - This is an interface to the mcrypt library, which supports a wide - variety of block algorithms such as DES, TripleDES, Blowfish - (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and - GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it - supports RC6 and IDEA which are considered "non-free". - - - Mcrypt can be used to encrypt and decrypt using the above - mentioned ciphers. If you linked against libmcrypt-2.2.x, the - four important mcrypt commands (mcrypt_cfb, - mcrypt_cbc, mcrypt_ecb, - and mcrypt_ofb) can operate in both modes - which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively. - - Encrypt an input value with TripleDES under 2.2.x in ECB mode - +
+ &reftitle.intro; + + This is an interface to the mcrypt library, which supports a wide + variety of block algorithms such as DES, TripleDES, Blowfish + (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and + GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it + supports RC6 and IDEA which are considered "non-free". + + + Mcrypt can be used to encrypt and decrypt using the above + mentioned ciphers. If you linked against libmcrypt-2.2.x, the + four important mcrypt commands (mcrypt_cfb, + mcrypt_cbc, mcrypt_ecb, + and mcrypt_ofb) can operate in both modes + which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively. + + Encrypt an input value with TripleDES under 2.2.x in ECB mode + ]]> - - - This example will give you the encrypted data as a string in - $encrypted_data. - - - If you linked against libmcrypt 2.4.x or 2.5.x, these functions are still - available, but it is recommended that you use the advanced functions. - - Encrypt an input value with TripleDES under 2.4.x and higher in ECB mode - + + + This example will give you the encrypted data as a string in + $encrypted_data. + + + If you linked against libmcrypt 2.4.x or 2.5.x, these functions are still + available, but it is recommended that you use the advanced functions. + + Encrypt an input value with TripleDES under 2.4.x and higher in ECB mode + ]]> - - - This example will give you the encrypted data as a string in - $encrypted_data. For a full example see - mcrypt_module_open. - + + + This example will give you the encrypted data as a string in + $encrypted_data. For a full example see + mcrypt_module_open. + +
- Requirements + &reftitle.required; These functions work using mcrypt. @@ -75,7 +78,7 @@ $encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT);
- Installation + &reftitle.install; To use it, download libmcrypt-x.x.tar.gz from here and follow the included installation @@ -87,71 +90,21 @@ $encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT);
- Runtime Configuration + &reftitle.runtime;
- Resource types - &no.resource; + &reftitle.resources; + &no.resource;
-
- Predefined constants - - - Mcrypt can operate in four block cipher modes (CBC, OFB, CFB, and - ECB). If linked against libmcrypt-2.4.x or higher the functions can also operate - in the block cipher mode nOFB and in STREAM mode. Below you find a list - with all supported encryption modes together with the constants that are - defines for the encryption mode. For a more complete reference and - discussion see &book.applied.cryptography;. - - - - MCRYPT_MODE_ECB (electronic codebook) is suitable for random data, - such as encrypting other keys. Since data there is short and random, - the disadvantages of ECB have a favorable negative effect. - - - - - MCRYPT_MODE_CBC (cipher block chaining) is especially suitable for - encrypting files where the security is increased over ECB - significantly. - - - - - MCRYPT_MODE_CFB (cipher feedback) is the best mode for encrypting byte - streams where single bytes must be encrypted. - - - - - MCRYPT_MODE_OFB (output feedback, in 8bit) is comparable to CFB, but - can be used in applications where error propagation cannot - be tolerated. It's insecure (because it operates in 8bit - mode) so it is not recommended to use it. - - - - - MCRYPT_MODE_NOFB (output feedback, in nbit) is comparable to OFB, but - more secure because it operates on the block size of the algorithm. - - - - - MCRYPT_MODE_STREAM is an extra mode to include some stream algorithms - like WAKE or RC4. - - - - - + &reference.mcrypt.constants; + +
+ Mcrypt ciphers Here is a list of ciphers which are currently supported by the mcrypt extension. For a complete list of supported ciphers, see the defines at