note 69580 added to function.mcrypt-encrypt

From: Date: Mon, 11 Sep 2006 20:11:34 +0000
Subject: note 69580 added to function.mcrypt-encrypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-117028@lists.php.net to get a copy of this message
Most of the user-written cipher examples here are badly broken, and there are a few cases where the manual says things that are outright incorrect, such as that it's "safe to transmit the initialization vector in plaintext" (this is incorrect: see Ciphers By Ritter, http://www.ciphersbyritter.com/GLOSSARY.HTM#IV , for details.) mcrypt itself is perfectly safe, but correct and therefore safe usage is inobvious. It is important to use a cryptographic library correctly; a simple usage error, even when it produces results that can be unpacked at the other side, can render a strong algorithm completely useless. The initialization vector must be permuted with a recoverable noise source (an arbitrary md5 hash is acceptable, since it's just a fake OTP and its origin contents are wholly unimportant.) Passwords should be remade with a salted one-way hash (md5 is again acceptable even though it's been damaged, since the only thing you could recover from a cracked md5 hash is the source data to generate the password, which is useless.) It's important to use a sane block mode (OFB is unsafe for almost all algorithms; never use it. Prefer CBC in all cases except where you need to deal with a degraded signal and cannot retransmit.) A correct usage example is actually pretty long and needs a lot of explanation, so I developed a safe wrapper library which doesn't constrain usage and which comments itself very heavily. It's appropriate for use or for learning. Please see my blog for details on Stone PHP SafeCrypt: http://blog.sc.tri-bit.com/archives/101 ---- Server IP: 66.163.161.117 Probable Submitter: 75.28.3.231 ---- Manual Page -- http://www.php.net/manual/en/function.mcrypt-encrypt.php Edit -- https://master.php.net/note/edit/69580 Del: integrated -- https://master.php.net/note/delete/69580/integrated Del: useless -- https://master.php.net/note/delete/69580/useless Del: bad code -- https://master.php.net/note/delete/69580/bad+code Del: spam -- https://master.php.net/note/delete/69580/spam Del: non-english -- https://master.php.net/note/delete/69580/non-english Del: in docs -- https://master.php.net/note/delete/69580/in+docs Del: other reasons-- https://master.php.net/note/delete/69580 Reject -- https://master.php.net/note/reject/69580 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117028) next »