I am not sure if it will help of if you have already tried this but try all of the cipher modes available for the tripledes cipher (eg. cfb, ecb, etc.). There may be a difference in the way .net and mcrypt produces the cipher text but if that were the case then it wouldn't be a true tripledes encryption for either the .net or mcrypt encryption libraries. Are you able to view the source of the .net code which originally produced the cipher text? If so then see what mode it is using with the tripledes cipher. And you are right about the documentation, it took me awhile to get it working and even longer to figure out how it worked. Good luck,
Jas


Craig wrote:
Hi all,

I am truly hoping that someone can help with this.
I am making the ecommerce site for a product that
I had nothing to do with the development of. =)

The product is making a licence file using  the .net
3des, but I am not able to get the same output using
the mcrypt 3des.

this is the .net original text and the cipher text:
Golf Genie 5.0
ª:b•#–æaŒž"[EMAIL PROTECTED]">#p0, 7

this is what i get
¿^U`ÎdÀ4`oãõwÑî%  - from Golf Genie 5.0
¿^U`ÎdÀ4!é$”GIø  - from Golf Genie 5.0\r\n


I don't know too much about encyrption, and I have found the documentation of mcrypt to be the worst of any php module I have yet used, so i'm not sure of the consequenses of using cbc versus ecb are, etc.

here is the code i am using.

   $key =
"\x6B\x00\x64\x00\x4E\x00\x44\x00\x38\x00\x37\x00\x5E\x00\x21\x00";
   $input = "Golf Genie 5.0";
   $iv  = "\x2B\x00\x5F\x00\x65\x00\x6B\x00";

   $td = mcrypt_module_open ('tripledes', '', 'cbc', '');
   mcrypt_generic_init ($td, $key, $iv);
   $encrypted_data = mcrypt_generic ($td, $input);
   mcrypt_module_close ($td);

echo $encrypted_data;

ps. I can't use mcrypt_generic_deinit - i get 'Fatal error: Call to
undefined function: mcrypt_generic_deinit()... '

thanks in advance,
Craig

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to