[PHP] Converting PHP code to C#?

2007-09-07 Thread Symbian
Hi, I'm not sure if this is the right place to post this, I have some decryption routines that use mcrypt that I need to decrypt in .NET, does anyone know how why I cant get this to work? PHP $mcryptSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $mcryptIV = mcrypt_create_i

Re: [PHP] Converting PHP code to C#?

2007-09-07 Thread Symbian
Mike, Thanks for the reply and your very useful notes. I'm unable to workout how to get the same IV as the one generated by the PHP script is random. The thing is that we cant change the PHP script as its readily being used now. Maybe I should look at the encryption routine and reverse that firs

Re: [PHP] Converting PHP code to C#?

2007-09-08 Thread Symbian
mike-22 wrote: > > just hard code the IV in both places. > Thanks for the link, that was most useful, especially the commented bits! RE: The IV, reading the php manual it states that the IV is not used when ECB mode is used (which is what we are using). So knowing this does the use of IV mat

[PHP] Pack function in C#

2007-09-08 Thread Symbian
hello, Our PHP dev (who has since left) uses the pack function to turn a base64 string into a binary blob (?): $blob = pack("H*", $postBase64Data); Does anyone know what the above is doing? I need to translate that to C# terms, which I thought was getting the eqivalent of the bytes: byte[] blo

Re: [PHP] Converting PHP code to C#?

2007-09-08 Thread Symbian
mike-22 wrote: > > i'm pretty sure the IV mattered in our stuff. > > and remember i used CBC i think not EBC, and it worked fine. not sure > if you want to try that and make it work for you or not without any > warnings :) > Ah! We're using EBC, also I realised that I needed to implement the