php RIJNDAEL encryption example

php RIJNDAEL encryption example

Postby Saman » Wed Jul 14, 2010 12:27 am

Code: Select all

<?php
   $iv_size 
mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256MCRYPT_MODE_ECB);
   
$iv mcrypt_create_iv($iv_sizeMCRYPT_RAND);
   
$key "my key";
   
$text "my message";
   
$crypttext mcrypt_encrypt(MCRYPT_RIJNDAEL_256$key$textMCRYPT_MODE_ECB$iv);
   echo 
'plain: ' $text 'length: ' strlen($text) . "<br>";
   echo 
'cypher: ' $crypttext 'length: ' strlen($crypttext) . "<br>";
?>
User avatar
Saman
 
Posts: 160
Joined: Fri Jul 31, 2009 5:02 pm
Cash on hand: 79,385.00
Medals: 1
EC_Achievment (1)

Invitations sent: 0
Registered friends: 0

Return to PHP & MySQL

Who is online

Users browsing this forum: No registered users and 1 guest