goba Mon Jul 22 13:00:34 2002 EDT
Modified files:
/phpdoc/en/reference/mcrypt reference.xml
Log:
Putting examples to examples section
Index: phpdoc/en/reference/mcrypt/reference.xml
diff -u phpdoc/en/reference/mcrypt/reference.xml:1.4
phpdoc/en/reference/mcrypt/reference.xml:1.5
--- phpdoc/en/reference/mcrypt/reference.xml:1.4 Mon Jul 22 12:58:08 2002
+++ phpdoc/en/reference/mcrypt/reference.xml Mon Jul 22 13:00:32 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<reference id="ref.mcrypt">
<title>Mcrypt Encryption Functions</title>
<titleabbrev>mcrypt</titleabbrev>
@@ -14,53 +14,6 @@
GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it
supports RC6 and IDEA which are considered "non-free".
</para>
- <para>
- 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 (<function>mcrypt_cfb</function>,
- <function>mcrypt_cbc</function>, <function>mcrypt_ecb</function>,
- and <function>mcrypt_ofb</function>) can operate in both modes
- which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively.
- <example>
- <title>Encrypt an input value with TripleDES under 2.2.x in ECB mode</title>
- <programlisting role="php">
-<![CDATA[
-<?php
-$key = "this is a very secret key";
-$input = "Let us meet at 9 o'clock at the secret place.";
-
-$encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT);
-?>
-]]>
- </programlisting>
- </example>
- This example will give you the encrypted data as a string in
- <literal>$encrypted_data</literal>.
- </para>
- <para>
- 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.
- <example>
- <title>Encrypt an input value with TripleDES under 2.4.x and higher in ECB
mode</title>
- <programlisting role="php">
-<![CDATA[
-<?php
- $key = "this is a very secret key";
- $input = "Let us meet at 9 o'clock at the secret place.";
-
- $td = mcrypt_module_open ('tripledes', '', 'ecb', '');
- $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
- mcrypt_generic_init ($td, $key, $iv);
- $encrypted_data = mcrypt_generic ($td, $input);
- mcrypt_generic_end ($td);
-?>
-]]>
- </programlisting>
- </example>
- This example will give you the encrypted data as a string in
- <literal>$encrypted_data</literal>. For a full example see
- <function>mcrypt_module_open</function>.
- </para>
</section>
<section id="mcrypt.requirements">
@@ -167,6 +120,57 @@
Alternatively, you can transmit the IV together with the encrypted
data (see chapter 9.3 of &book.applied.cryptography; for a
discussion of this topic).
+ </para>
+ </section>
+
+ <section id="mcrypt.examples">
+ &reftitle.examples;
+ <para>
+ 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 (<function>mcrypt_cfb</function>,
+ <function>mcrypt_cbc</function>, <function>mcrypt_ecb</function>,
+ and <function>mcrypt_ofb</function>) can operate in both modes
+ which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively.
+ <example>
+ <title>Encrypt an input value with TripleDES under 2.2.x in ECB mode</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$key = "this is a very secret key";
+$input = "Let us meet at 9 o'clock at the secret place.";
+
+$encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT);
+?>
+]]>
+ </programlisting>
+ </example>
+ This example will give you the encrypted data as a string in
+ <literal>$encrypted_data</literal>.
+ </para>
+ <para>
+ 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.
+ <example>
+ <title>Encrypt an input value with TripleDES under 2.4.x and higher in ECB
+mode</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+ $key = "this is a very secret key";
+ $input = "Let us meet at 9 o'clock at the secret place.";
+
+ $td = mcrypt_module_open ('tripledes', '', 'ecb', '');
+ $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
+ mcrypt_generic_init ($td, $key, $iv);
+ $encrypted_data = mcrypt_generic ($td, $input);
+ mcrypt_generic_end ($td);
+?>
+]]>
+ </programlisting>
+ </example>
+ This example will give you the encrypted data as a string in
+ <literal>$encrypted_data</literal>. For a full example see
+ <function>mcrypt_module_open</function>.
</para>
</section>
</partintro>
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php