Craig,
If that doesn't work I am almost certain there might be a discrepency in how the .net & mcrypt libraries actually employ the triple des cipher.


On another note, I couldn't get the mcrypt_deinit function to work without error as well. One thing you could do is use the PHP unset() call to unlink your variables once data has been passed through your cipher.

I would post your problem to the developers of the mcrypt app at mcrypt.sourceforge.net, I have talked with the guys over there and have always gotten help. I am sure they would want to know about this as well.
HTH
Jas


Craig wrote:

> 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


I did check out the .net documentation and it uses cbc, but maybe I'll
try
the other modes for kicks.

-Craig

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



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



Reply via email to