note 89554 added to function.mcrypt-encrypt
| From: | KaiSellgren at osu1 dot php dot net | Date: | Fri, 13 Mar 2009 11:03:03 +0000 |
| Subject: | note 89554 added to function.mcrypt-encrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151825@lists.php.net to get a copy of this message | ||
There are a couple of things to remember when encrypting data.
1) For CBC, the IV must be random, but not unique. It also must not be known.
2) For CTR, the IV must be unique and not known, but does not need to be random.
3) The key of the encryption is really important.
4) The random used in the previous example of mine is not that great. The post was a response to
earlier post saying "for those that just want some simple encryption/decryption". Use
better random functions. MCRYPT_RAND just uses the built-in linear congruential generator, which is
poor.
5) You may consider using RIJNDAEL-512 or even -1024.
6) If you want to be able to have NULL bytes in your plaintext, then you should store the plaintext
length within the encrypted text to strip out padded NULL bytes.
----
Server IP: 212.124.37.9
Probable Submitter: 81.175.154.102
----
Manual Page -- http://www.php.net/manual/en/function.mcrypt-encrypt.php
Edit -- https://master.php.net/note/edit/89554
Del: integrated -- https://master.php.net/note/delete/89554/integrated
Del: useless -- https://master.php.net/note/delete/89554/useless
Del: bad code -- https://master.php.net/note/delete/89554/bad+code
Del: spam -- https://master.php.net/note/delete/89554/spam
Del: non-english -- https://master.php.net/note/delete/89554/non-english
Del: in docs -- https://master.php.net/note/delete/89554/in+docs
Del: other reasons-- https://master.php.net/note/delete/89554
Reject -- https://master.php.net/note/reject/89554
Search -- https://master.php.net/manage/user-notes.php