Top
3DES Encryption with PHP – Dragos Cirjan
fade
761
post-template-default,single,single-post,postid-761,single-format-standard,flow child-child-ver-1.0.0,flow-ver-1.3.6,,eltd-smooth-page-transitions,ajax,eltd-blog-installed,page-template-blog-standard,eltd-header-standard,eltd-fixed-on-scroll,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-dropdown-default

Warning: A non-numeric value encountered in /usr/src/wordpress/wp-content/themes/flow/framework/modules/title/title-functions.php on line 417

3DES Encryption with PHP

3DES Encryption with PHP

An if I started with 3DES encryption, I thought… why stop?
Here is the PHP Version as well.

function encrypt3DES($key,$iv,$text_enc){
     $block = mcrypt_get_block_size('tripledes', 'cbc');
     $pad = $block - (strlen($text_enc) % $block);
     $text_enc .= str_repeat(chr($pad), $pad);
     $text_enc = mcrypt_encrypt(MCRYPT_3DES, $key, $text_enc, MCRYPT_MODE_CBC, $iv);
     $text_enc = base64_encode ($text_enc);
     return $text_enc;
 }
 
 echo "\n";
 
 echo encrypt3DES("62v01fVsCWHfRcW\0\0\0\0\0\0\0\0\0", "\0\0\0\0\0\0\0\0", "66866996699") . "\n";
Cirjan Dragos
No Comments

Post a Comment