Page 1 of 1

Encyption experts ?

Posted: Sat Apr 30, 2011 8:35 pm
by Naminator_X_
Hello there.
I'm trying to ressurect a dead MMO (dead not because of community i might say) - im doing it for fun and to strengthen my proramming knowledge. It is the first project i try to reverse engineer so yeah it's pretty difficult for me :/

So is there any C# programmer with decent knowledge in blowfish encryption/decryption willing to help me ? Having in mind that i have the encryption key, the P and S boxes exported from the client !

I've tried finding open blowfish libraries and edit them to my taste but i'm doing it wrong :/
So if there is somebody willing to help me please leave a comment and i'll contact you with more informaton.

P.S: Yeah i know this is Java based community but you are like the best open source community that i know of so i'm giving it a shot :) dont kill me

Re: Encyption experts ?

Posted: Thu May 19, 2011 3:45 am
by Forsaiken
http://www.koders.com/csharp/fidD5E0D7A ... 1B953.aspx

This is the first result in google for "c# blowfish"...

Don`t forget to append the padding bytes:

Code: Select all

 packetSize += 4;packetSize += (8 - packetSize % 8); 
and after the ofc the padding:

Code: Select all

 final int count = offset + size - 4; //offset = starting byte of packet, size = packetSize (with padding bytes)int checksum = 0;for (; offset < count; offset += 4){    checksum ^= ArrayUtil.getD(raw, offset); // little endian 4bytes starting at offset = int}ArrayUtil.putD(raw, offset, checksum); // little endian 4bytesstarting at offset = int 
Here is the code to check if padding is ok:

Code: Select all

 if (size <= 4 || (size & 0x03) != 0) // min packet size is 4 and the packet len must always be a base of 4, so 4 - 8 - 12 - 16 etc    return false; final int count = offset + size - 4;int checksum = 0;    for (; offset < count; offset += 4){    checksum ^= ArrayUtil.getD(raw, offset);} return checksum == ArrayUtil.getD(raw, offset); // returns true if the checksum matches expected: OK 
So when sending a packet append the padding bytes then append the checksum then use the blowfish.
When receiving use blowfish and then check checksum.

Re: Encyption experts ?

Posted: Fri May 20, 2011 8:06 am
by Naminator_X_
The blowfish algorithm is slightly changed. I know it's stupid but hey ... it is not me who made the client in the first place :D Thanks for the links btw and especially for the checksum code /socialbow (l2 style) :)

PS: We've figured it out already