note 101059 added to book.mcrypt
| From: | ghoffman at salientdigital dot com | Date: | Tue, 23 Nov 2010 21:23:41 +0000 |
| Subject: | note 101059 added to book.mcrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-174300@lists.php.net to get a copy of this message | ||
If you want a quick way to see what ciphers, modes, key, block and iv sizes are supported on your
server, try something like the following.
Note: I used this simple bash:
locate libmcrypt from terminal on Mac OS X to determine
the install paths to the algorithms and modes directories. Lots of function calls generate warnings
for certain ciphers, hence the use of error suppression.
<?php
$modes = mcrypt_list_modes();
$algorithms = mcrypt_list_algorithms();
foreach($algorithms as $cipher)
{
echo "<h1 style=\"border-top:1px solid
black;\">".$cipher."</h1>\n";
foreach($modes as $mode)
{
echo "<h3>".$mode."</h3>\n";
@$td = mcrypt_module_open(
$cipher,
'/usr/local/libmcrypt-2.5.8/modules/algorithms/',
$mode,
'/usr/local/libmcrypt-2.5.8/modules/modes/');
@$key_size = mcrypt_enc_get_key_size($td);
@$block_size = mcrypt_get_block_size($cipher,$mode);
@$iv_size = mcrypt_get_iv_size($cipher, $mode);
@mcrypt_module_close($td);
echo "
<pre>
key_size: ". ($key_size?$key_size:'n/a')
." block_size: ". ($block_size?$block_size:'n/a')
." iv_size: ". ($iv_size?$iv_size:'n/a')
." </pre>\n";
$td=NULL;
$key_size=NULL;
$block_size=NULL;
$iv_size=NULL;
}
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 70.166.218.198
----
Manual Page -- http://www.php.net/manual/en/book.mcrypt.php
Edit -- https://master.php.net/note/edit/101059
Del: integrated -- https://master.php.net/note/delete/101059/integrated
Del: useless -- https://master.php.net/note/delete/101059/useless
Del: bad code -- https://master.php.net/note/delete/101059/bad+code
Del: spam -- https://master.php.net/note/delete/101059/spam
Del: non-english -- https://master.php.net/note/delete/101059/non-english
Del: in docs -- https://master.php.net/note/delete/101059/in+docs
Del: other reasons-- https://master.php.net/note/delete/101059
Reject -- https://master.php.net/note/reject/101059
Search -- https://master.php.net/manage/user-notes.php