note 89831 added to function.mcrypt-module-open

From: Date: Wed, 25 Mar 2009 11:18:13 +0000
Subject: note 89831 added to function.mcrypt-module-open
Groups: php.notes 
Request: Send a blank email to php-notes+get-152415@lists.php.net to get a copy of this message
about the previous comments on hex formatting and capitalization as a way to improve the key: this would seem pretty obvious, but it is a choice to be limited to only hex characters ([0-9a-z]); you can get the original RAW output from md5() or sha1() and not the default readable hex formatting. the result of a raw output will be 16 o 20 (depending on the hash function being used) series of chars in the range 0-255. way better than [0-9a-z] and even [0-9a-zA-Z]. 16 or 20 is generally lower than the maximum key lenght ($ks in the example), but you can append two or more keys together: <?php $human_key1 = 'something very secret'; $human_key2 = 'something else very secret'; // 40 bytes binary key using two "human readable" keys and sha1. $bigger_binary_key = sha1($human_key1, true) . sha1($human_key2, true); // then just use it as you would (extract taken from the example) $key = substr($bigger_binary_key, 0, $ks); ?> ... or you can automatically split one large "human key" into two or more parts, hash those parts with sha1 (raw output!) and merge them together again (in original order or rearrange, salt, transform them as you like) to get a binary key of 40, 60, 80 or more chars depending on the number of parts the secret key has been splitted =) ---- Server IP: 201.216.232.3 Probable Submitter: 190.31.142.179 ---- Manual Page -- http://www.php.net/manual/en/function.mcrypt-module-open.php Edit -- https://master.php.net/note/edit/89831 Del: integrated -- https://master.php.net/note/delete/89831/integrated Del: useless -- https://master.php.net/note/delete/89831/useless Del: bad code -- https://master.php.net/note/delete/89831/bad+code Del: spam -- https://master.php.net/note/delete/89831/spam Del: non-english -- https://master.php.net/note/delete/89831/non-english Del: in docs -- https://master.php.net/note/delete/89831/in+docs Del: other reasons-- https://master.php.net/note/delete/89831 Reject -- https://master.php.net/note/reject/89831 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152415) next »