Encyption experts ?

If something doesn't fit in any other forum then post it here.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Naminator_X_
Posts: 39
Joined: Thu Jun 10, 2010 9:06 am

Encyption experts ?

Post 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
Forsaiken
L2j Veteran
L2j Veteran
Posts: 99
Joined: Sun Mar 11, 2007 6:23 pm

Re: Encyption experts ?

Post 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.
http://code.google.com/p/g3d-editor/
Experienced in the following languages/apis/ides: Java using Eclipse/AWT/Swing/NIO/JNI/Jogl, C/C++11/c++14 using QT/MFC/BOOST/STL/VS2012/VS2013/OpenGL/DirectX, Delphi using Borland, .NET/C# using VS2012/VS2013
Naminator_X_
Posts: 39
Joined: Thu Jun 10, 2010 9:06 am

Re: Encyption experts ?

Post 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
Post Reply