Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 02:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] The New Cryptography [Cast-128/Cast-5]

Discussion on [Release] The New Cryptography [Cast-128/Cast-5] within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Closed Thread
 
Old 07/19/2011, 06:58   #16
 
chickmagnet's Avatar
 
elite*gold: 0
Join Date: Jun 2009
Posts: 372
Received Thanks: 53
Quote:
Originally Posted by Mr_PoP View Post
that's not quit correct even if it worked!
it works fine for this dont think it matters much since it allow a login which is wat its supose 2 do
chickmagnet is offline  
Old 07/19/2011, 07:21   #17
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Quote:
Originally Posted by Mr_PoP View Post
that's not quit correct even if it worked!
There are many ways of implementing it.
This is the way that I found. ._.
Just because it's different doesn't mean that it isn't correct.
Spirited is offline  
Old 07/19/2011, 12:52   #18
 
Iron~Man's Avatar
 
elite*gold: 0
Join Date: Dec 2010
Posts: 162
Received Thanks: 31
Since what patch is this cryptography?
Iron~Man is offline  
Old 07/19/2011, 12:55   #19
 
lostsolder05's Avatar
 
elite*gold: 20
Join Date: Jan 2006
Posts: 890
Received Thanks: 241
Quote:
Originally Posted by Iron~Man View Post
Since what patch is this cryptography?
5509
lostsolder05 is online now  
Old 07/19/2011, 15:09   #20
 
Mr_PoP's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 759
Received Thanks: 285
Quote:
Originally Posted by Fаng View Post
There are many ways of implementing it.
This is the way that I found. ._.
Just because it's different doesn't mean that it isn't correct.
it's not correct because you're allocating mroe than cast_st needs
Mr_PoP is offline  
Old 07/19/2011, 15:18   #21
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
Quote:
Originally Posted by Mr_PoP View Post
it's not correct because you're allocating mroe than cast_st needs
That doesn't have anything to do with the thread I posted.
That's their file's code.
Spirited is offline  
Old 07/19/2011, 16:16   #22
 
CØĐ£Ř||Mã©hÍñє's Avatar
 
elite*gold: 0
Join Date: May 2010
Posts: 248
Received Thanks: 36
not working changed them all

PHP Code:
using System;
using System.Runtime.InteropServices;

namespace 
Conquer_Online_Server.Network.Cryptography
{
    public class 
GameCryptography
    
{
        
Blowfish _blowfish;
        public 
GameCryptography(byte[] key)
        {
            
_blowfish = new Blowfish(BlowfishAlgorithm.CFB64);
            
_blowfish.SetKey(key);
        }

        public 
void Decrypt(byte[] packet)
        {
            
byte[] buffer _blowfish.Decrypt(packet);
            
System.Buffer.BlockCopy(buffer0packet0buffer.Length);
        }

        public 
void Encrypt(byte[] packet)
        {
            
byte[] buffer _blowfish.Encrypt(packet);
            
System.Buffer.BlockCopy(buffer0packet0buffer.Length);
        }

        public 
Blowfish Blowfish
        
{
            
get { return _blowfish; }
        }
        public 
void SetKey(byte[] k)
        {
            
_blowfish.SetKey(k);
        }
        public 
void SetIvs(byte[] i1byte[] i2)
        {
            
_blowfish.EncryptIV i1;
            
_blowfish.DecryptIV i2;
        }
    }

    public 
enum BlowfishAlgorithm
    
{
        
ECB,
        
CBC,
        
CFB64,
        
OFB64,
    };

    public class 
Blowfish IDisposable
    
{
        [
DllImport("libeay32.dll")]
        public 
extern static void CAST_set_key(IntPtr _keyint lenbyte[] data);

        [
DllImport("libeay32.dll")]
        public 
extern static void BF_ecb_encrypt(byte[] in_byte[] out_IntPtr scheduleint enc);

        [
DllImport("libeay32.dll")]
        public 
extern static void BF_cbc_encrypt(byte[] in_byte[] out_int lengthIntPtr schedulebyte[] ivecint enc);

        [
DllImport("libeay32.dll")]
        public 
extern static void CAST_cfb64_encrypt(byte[] in_byte[] out_int lengthIntPtr schedulebyte[] ivecref int numint enc);

        [
DllImport("libeay32.dll")]
        public 
extern static void BF_ofb64_encrypt(byte[] in_byte[] out_int lengthIntPtr schedulebyte[] ivecout int num);

        [
StructLayout(LayoutKind.Sequential)]
        
struct bf_key_st
        
{
            [
MarshalAs(UnmanagedType.ByValArraySizeConst 18)]
            public 
UInt32[] P;
            [
MarshalAs(UnmanagedType.ByValArraySizeConst 1024)]
            public 
UInt32[] S;
        }

        private 
BlowfishAlgorithm _algorithm;
        private 
IntPtr _key;
        private 
byte[] _encryptIv;
        private 
byte[] _decryptIv;
        private 
int _encryptNum;
        private 
int _decryptNum;

        public 
Blowfish(BlowfishAlgorithm algorithm)
        {
            
_algorithm algorithm;
            
_encryptIv = new byte[8] { 0000000};
            
_decryptIv = new byte[8] { 0000000};
            
bf_key_st key = new bf_key_st();
            
key.= new UInt32[16 2];
            
key.= new UInt32[256];
            
_key Marshal.AllocHGlobal(key.P.Length sizeof(UInt32) + key.S.Length sizeof(UInt32));
            
Marshal.StructureToPtr(key_keyfalse);
            
_encryptNum 0;
            
_decryptNum 0;
        }

        public 
void Dispose()
        {
            
Marshal.FreeHGlobal(_key);
        }

        public 
void SetKey(byte[] data)
        {
            
_encryptNum 0;
            
_decryptNum 0;
            
CAST_set_key(_keydata.Lengthdata);
        }

        public 
byte[] Encrypt(byte[] buffer)
        {
            
byte[] ret = new byte[buffer.Length];
            switch (
_algorithm)
            {
                case 
BlowfishAlgorithm.ECB:
                    
BF_ecb_encrypt(bufferret_key1);
                    break;
                case 
BlowfishAlgorithm.CBC:
                    
BF_cbc_encrypt(bufferretbuffer.Length_key_encryptIv1);
                    break;
                case 
BlowfishAlgorithm.CFB64:
                    
CAST_cfb64_encrypt(bufferretbuffer.Length_key_encryptIvref _encryptNum1);
                    break;
                case 
BlowfishAlgorithm.OFB64:
                    
BF_ofb64_encrypt(bufferretbuffer.Length_key_encryptIvout _encryptNum);
                    break;
            }
            return 
ret;
        }

        public 
byte[] Decrypt(byte[] buffer)
        {
            
byte[] ret = new byte[buffer.Length];
            switch (
_algorithm)
            {
                case 
BlowfishAlgorithm.ECB:
                    
BF_ecb_encrypt(bufferret_key0);
                    break;
                case 
BlowfishAlgorithm.CBC:
                    
BF_cbc_encrypt(bufferretbuffer.Length_key_decryptIv0);
                    break;
                case 
BlowfishAlgorithm.CFB64:
                    
CAST_cfb64_encrypt(bufferretbuffer.Length_key_decryptIvref _decryptNum0);
                    break;
                case 
BlowfishAlgorithm.OFB64:
                    
BF_ofb64_encrypt(bufferretbuffer.Length_key_decryptIvout _decryptNum);
                    break;
            }
            return 
ret;
        }

        public 
byte[] EncryptIV
        
{
            
get { return _encryptIv; }
            
set System.Buffer.BlockCopy(value0_encryptIv08); }
        }

        public 
byte[] DecryptIV
        
{
            
get { return _decryptIv; }
            
set System.Buffer.BlockCopy(value0_decryptIv08); }
        }
    }

CØĐ£Ř||Mã©hÍñє is offline  
Old 07/19/2011, 17:13   #23
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
If it doesnt work you've done it wrong, im not going to look thru the code you posted.
_DreadNought_ is offline  
Old 07/19/2011, 17:21   #24
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
how did u changed why the BF is there yet?

BF_ecb_encryp???? its CAST NOT BF!!
12tails is offline  
Old 07/19/2011, 18:21   #25
 
CØĐ£Ř||Mã©hÍñє's Avatar
 
elite*gold: 0
Join Date: May 2010
Posts: 248
Received Thanks: 36
Quote:
Originally Posted by _DreadNought_ View Post
If it doesnt work you've done it wrong, im not going to look thru the code you posted.
nothing with your business never asked you to look out that thread got thread owner he can answer whats wrong i did and yes thanks leo
CØĐ£Ř||Mã©hÍñє is offline  
Old 07/19/2011, 21:06   #26
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
Quote:
Originally Posted by CØĐ£Ř||Mã©hÍñє View Post
nothing with your business never asked you to look out that thread got thread owner he can answer whats wrong i did and yes thanks leo
Not converted this to unsafe(quicker processing) or cleaned it, Just a quick sketch on actually logging in with the new algorithm.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ConquerSource.Core;
using System.Runtime.InteropServices;

namespace ConquerSource.Game.Cryptography
{
    public class GameCrypto
    {
        readonly CAST5 _Cast;
        public GameCrypto(byte[] key)
        {
            _Cast = new CAST5(CastAlgorithm.CFB64);
            _Cast.SetKey(key);
        }

        public void Decrypt(byte[] packet)
        {
            byte[] buffer = _Cast.Decrypt(packet);
            Buffer.BlockCopy(buffer, 0, packet, 0, buffer.Length);
        }

        public void Encrypt(byte[] packet)
        {
            byte[] buffer = _Cast.Encrypt(packet);
            Buffer.BlockCopy(buffer, 0, packet, 0, buffer.Length);
        }

        public CAST5 Blowfish
        {
            get { return _Cast; }
        }
        public void SetKey(byte[] k)
        {
            _Cast.SetKey(k);
        }
        public void SetIvs(byte[] i1, byte[] i2)
        {
            _Cast.EncryptIV = i1;
            _Cast.DecryptIV = i2;
        }
    }

    public enum CastAlgorithm
    {
        ECB,
        CBC,
        CFB64,
        OFB64,
    };

    public class CAST5
    {
        [StructLayout(LayoutKind.Sequential)]
        struct CAST_key_st
        {
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
            public UInt32[] P;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
            public UInt32[] S;
        }
        private CastAlgorithm _Type;
        private IntPtr Key;
        private byte[] _EncryptIV;
        private byte[] _DecryptIV;
        private int _EncryptKey;
        private int _DecryptKey;

        public CAST5(CastAlgorithm AlgorithmType)
        {
            _Type = AlgorithmType;
            _EncryptIV = new byte[8];
            _DecryptIV = new byte[8];

            CAST_key_st key = new CAST_key_st();
            key.P = new UInt32[16 + 2];
            key.S = new UInt32[4 * 256];

            Key = Marshal.AllocHGlobal(key.P.Length * sizeof(UInt32) + key.S.Length * sizeof(UInt32));
            Marshal.StructureToPtr(key, Key, false);
        }
        public void SetKey(byte[] data)
        {
            Kernel.CAST_set_key(Key, data.Length, data);
            _DecryptKey = 0;
            _EncryptKey = 0;
        }

        public byte[] Encrypt(byte[] buffer)
        {
            byte[] ret = new byte[buffer.Length];
            switch (_Type)
            {
                case CastAlgorithm.CFB64:
                    Kernel.CAST_cfb64_encrypt(buffer, ret, buffer.Length, Key, _EncryptIV, out _EncryptKey, 1);
                    break;
            }
            return ret;
        }

        public byte[] Decrypt(byte[] buffer)
        {
            byte[] ret = new byte[buffer.Length];
            switch (_Type)
            {
                case CastAlgorithm.CFB64:
                    Kernel.CAST_cfb64_encrypt(buffer, ret, buffer.Length, Key, _DecryptIV, out _DecryptKey, 0);
                    break;
            }
            return ret;
        }

        public byte[] EncryptIV
        {
            get { return _EncryptIV; }
            set { Buffer.BlockCopy(value, 0, _EncryptIV, 0, 8); }
        }

        public byte[] DecryptIV
        {
            get { return _DecryptIV; }
            set { Buffer.BlockCopy(value, 0, _DecryptIV, 0, 8); }
        }
    }
}
Code:
        #region Cast5/Cast128
        [DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
        public extern static void CAST_set_key(IntPtr _key, int len, byte[] data);

        [DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
        public extern static void CAST_cfb64_encrypt(IntPtr _key, int len, byte[] data);

        [DllImport("libeay32.dll", CallingConvention = CallingConvention.Cdecl)]
        public extern static void CAST_cfb64_encrypt(byte[] in_, byte[] out_, int length, IntPtr schedule, byte[] ivec, out int num, int enc);
        #endregion
Suck it, noob.
_DreadNought_ is offline  
Thanks
5 Users
Old 07/19/2011, 22:36   #27
 
elite*gold: 0
Join Date: Mar 2009
Posts: 228
Received Thanks: 47


Is there any help ?
dego4ever is offline  
Old 07/19/2011, 22:41   #28
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by Y u k i View Post
Lowfyr gone, John came or wtf ever his name is, Ima quote something he posted at his introduction:



Now this all happened to fang releasing something.

if that wasnt an attempt of censoring, idk.
There has been no official word back on what the final decision was on the subject but all the threads magically re-appeared so I'd just say leave the whole topic dead unless they try to implement rules like this in the future.

No reason to bring up un-needed drama into an already rather dramatic forum/section
pro4never is offline  
Old 07/19/2011, 22:46   #29
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,282
Received Thanks: 4,191
I'm not helping anyone with this... none of you should be. If they can't follow such an easy guide- they don't deserve the help. They're obviously not trying.
Spirited is offline  
Thanks
5 Users
Old 07/19/2011, 22:55   #30
 
elite*gold: 0
Join Date: Mar 2009
Posts: 228
Received Thanks: 47
Talking

Quote:
Originally Posted by Fаng View Post
I'm not helping anyone with this... none of you should be. If they can't follow such an easy guide- they don't deserve the help. They're obviously not trying.
thanks any way fang
dego4ever is offline  
Closed Thread


Similar Threads Similar Threads
Frage zu Cast-Quest - Cast Rüssi Schurkin 777
11/17/2012 - Last Chaos Private Server - 17 Replies
Huhu wollte mal wissen wo man die Quest für die Casting sachen annimmt und bei welchen Mops man die droppt ... mit oder ohne rolle mit oder ohne samen? xD gibtn thanks danke gute nacht
cast titan schwert und cast dualls
06/20/2011 - Last Chaos - 16 Replies
ich habe da mal ne frage es gibt viele die sagen das man von compla kisten titan cast schwert und ritter cast dualls droppen kann was stimmt jetz gibt es die oder nicht ??
[Release]Cooldown/cast/Backward shoot hacks.
06/08/2011 - General Gaming Discussion - 78 Replies
:):):):):):):):):):):):):) /RUS/ Итак, решился я выложит& #1100; в паблик кое-что. Для начала нам понадоб& #1080;тся програм& #1084;а CheatEngine(далее СЕ), скачать СЕ можно http://rghost.ru/71027.Для начала, запуска& #1077;м реквием, логиним& #1089;я, заходим в игру.Сво рачивае& #1084; (альт+таб ;) и заходим в СЕ.В СЕ выбирае& #1084; процесс Requiem,в строке Value type выбирае& #1084; Text, далее в строку вводим названи& #1077; скилла, наприме& #1088; Молния,ж мем поиск.СЕ находит много значени& #1081;, теперь нам нужно найти группу скиллов: ...
*##WTB CAST SCHMUCK ODER CAST RüSTUNG Knight 85!Eternia##*
12/26/2010 - Last Chaos Trading - 5 Replies
Huhu LC Zocker.. Ich bin auf der Suche nach Cast Schmuck(Skill Cooldown) oder Ritter Rüstungsteile die Cast besitzen. MUSS EVA Siegeln haben! 85-87er! oder 105er oder 115er aber b6e ist pflicht^^ Natürlich auf Eternia Games.. Geplusst oder ungeplusst ist unwichtig. Hauptsache Cast b6e!
[Release] Quick Cast Plugin
02/24/2007 - Flyff - 0 Replies
Description: This is a simple plugin for FlyFF Termination (v1.55) that buffs a targeted player. This plugin does not speed up casting. It is just a time saver for assists, as it will cast all their available buffs on a player or themselves with one command. This plugin makes use of the new functionality provided in the version two SDK. (i reupload this update for the SDK on rapidshare bellow) Instructions: Install the plugin (you must have FlyFF Termination (v1.55) already installed). Once...



All times are GMT +1. The time now is 02:42.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.