Hello,
a C++ blowfish supports encrypting a block with less than < 8 letters,while .NET doesn't.Why?
-->C# NET Blowfish<-- -->C++ Blowfish<--
In both C++ and C# applications,I encrypt the following array
byte response[6] =
{
0x00, 0x80, 0x01, 0x61, 0x05, 0x06
};
In both C++ and C# applications,I call the Encrypt function with same parameters.
C++
Blowfish.Encrypt((LPBYTE)responce + 2,(LPBYTE)responce + 2, 4);
C#
Blowfish.Encrypt(responce, 2, responce, 2, responce.Length - 2);
However,In C++ I get the data encrypted,but not in C#.
Line 45,47 and 49 in C# NET Blowfish are the problematic lines,after the calculation at line 45 - the result becomes 0. line 47 becomes 2 + 0 = 2 and line 49 2 is not less than 2,so there's no loop.
There's some padding in C++ blowfish,but I get lost when I try to understand it.
My problem is that in C#, the padding must be exactly the same as in C++,so I get a valid answer.I can't use random padding and then remove the useless bytes after decryption,because the server I send the encrypted array is not mine.
Could you point me to what padding is used in the C++ blowfish and how it should be implemented in C# NET.
//Note I need not send this packet multiple times,only one time.
Thanks in advance!