mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Integrate another note
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@124639 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9a5f10ab70
commit
93ae4acaab
1 changed files with 19 additions and 1 deletions
|
@ -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>
|
||||
|
@ -20,6 +20,24 @@
|
|||
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
|
||||
<function>mcrypt_generic_init</function> with a key and an IV before
|
||||
|
|
Loading…
Reference in a new issue