How to using 3DES with MD5 / CFB Mode to Encrypt/Decrypt code ?

K

Kelvin

Dear all,

I don't know how to write a asp/vb/c# program to decrypt PHP encrypted code.

Here is attched my code in PHP

$key = "ab";
$random_number = kelvin;
$encrypted=encrypt($key,$random_number);
$decrypted=decrypt($key,$encrypted);

echo "NUMBER: $random_number<br>
ENCRYPTED VALUE: $encrypted<br>
DECRYPTED VALUE: $decrypted";

/* Your functions without the comments are below */

function encrypt($key, $plain_text) {
$plain_text = trim($plain_text);
$iv = substr(md5($key), 0,mcrypt_get_iv_size (MCRYPT_CAST_256,MCRYPT_MODE_CFB));
$c_t = mcrypt_cfb (MCRYPT_CAST_256, $key, $plain_text, MCRYPT_ENCRYPT, $iv);
return trim(chop(base64_encode($c_t)));
}


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top