cvs: phpdoc /en/reference/mcrypt/functions mcrypt-generic.xml
| From: | Derick Rethans | Date: | Fri, 25 Apr 2003 18:57:28 +0000 |
| Subject: | cvs: phpdoc /en/reference/mcrypt/functions mcrypt-generic.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969352870@lists.php.net to get a copy of this message | ||
derick Fri Apr 25 14:57:28 2003 EDT
Modified files:
/phpdoc/en/reference/mcrypt/functions mcrypt-generic.xml
Log:
- Integrate another note
Index: phpdoc/en/reference/mcrypt/functions/mcrypt-generic.xml
diff -u phpdoc/en/reference/mcrypt/functions/mcrypt-generic.xml:1.4
phpdoc/en/reference/mcrypt/functions/mcrypt-generic.xml:1.5
--- phpdoc/en/reference/mcrypt/functions/mcrypt-generic.xml:1.4 Fri Feb 21 22:44:32 2003
+++ phpdoc/en/reference/mcrypt/functions/mcrypt-generic.xml Fri Apr 25 14:57:28 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/mcrypt.xml, last change in rev 1.7 -->
<refentry id="function.mcrypt-generic">
<refnamediv>
@@ -19,6 +19,24 @@
function returns the encrypted data. Note that the length
of the returned string can in fact be longer then the input,
due to the padding of the data.
+ </para>
+ <para>
+ If you want to store the encrypted data in a database make sure to store
+ the entire string as returned by mcrypt_generic, or the string will not
+ entirely decrypt properly. If your original string is 10 characters long
+ and the block size is 8 (use
+ <function>mcrypt_enc_get_block_size</function> to determine the
+ blocksize), you would need at least 16 characters in your database field.
+ Note the string returned by <function>mdecrypt_generic</function> will be
+ 16 characters as well...use <function>rtrim</function>($str, "\0") to
+ remove the padding.
+ </para>
+ <para>
+ If you are for example storing the data in a MySQL database remember tha
+ varchar fields automatically have trailing spaces removed during
+ insertion. As encrypted data can end in a space (ASCII 32), the data will
+ be damaged by this removal. Store data in a tinyblob/tinytext (or
+ larger) field instead.
</para>
<para>
The encryption handle should always be initialized with