note 20267 added to ref.mcrypt
| From: | scott at boothcreek dot com | Date: | Thu, 28 Mar 2002 06:28:55 +0000 |
| Subject: | note 20267 added to ref.mcrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-28320@lists.php.net to get a copy of this message | ||
If you are using ECB mode to encrypt it does not seem to use the iv (initialization vector) for much
of anything, given the same key it will always decrypt it no matter what the iv is. If you use CBC
mode you must decrypt with the same iv that you encrypted with.
If you use a different iv before decrypting, your decrypt will not work. IMHO it seems better to
use CBC mode than ECB as ECB will always encrypt to the same cipher text given the same plain text
(leaving you open to know plaintext attacks). CBC uses the random iv which means text encrypts to
different things. You probably could get the same effect from using random keys in ECB mode.
Read that in the Schneier book - Applied Cryptography (ISBN 0-471-11709-9) This book is a must for
anyone seriously using any type of encryption.
--
http://www.php.net/manual/en/ref.mcrypt.php
http://master.php.net/manage/user-notes.php?action=edit+20267
http://master.php.net/manage/user-notes.php?action=delete+20267
http://master.php.net/manage/user-notes.php?action=reject+20267