SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AuthPacketCodec.h
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #pragma once
9 
10 #include <stdint.h>
11 #include <stdlib.h>
12 
13 typedef struct
14 {
15  unsigned long ek[32];
16  unsigned long dk[32];
17 } des_ctx;
18 typedef enum
19 {
20  EN0=0,
21  DE1=1
23 
25 {
26 public:
29  void SetXorKey(int key);
30  void SetDesKey(uint64_t key);
31  void Code(unsigned char *buffer,size_t size);
32  void Decode(unsigned char *buffer,size_t size);
33  void XorCodeBuf(unsigned char *buffer,size_t length);
34  void XorDecodeBuf(unsigned char *buffer,size_t length);
35  void DesCode(unsigned char *buffer,size_t size) const;
36  void DesDecode(unsigned char *buffer,size_t size) const;
37 private:
38 
39  des_ctx m_tDesContext;
40  long long xor_enc_key; //key for encryption
41  long long xor_dec_key; //key for decryption
42 };
void DesDecode(unsigned char *buffer, size_t size) const
Definition: AuthPacketCodec.cpp:421
void SetDesKey(uint64_t key)
Definition: AuthPacketCodec.cpp:347
Definition: AuthPacketCodec.h:13
Definition: AuthPacketCodec.h:24
~AuthPacketCodec()
Definition: AuthPacketCodec.h:28
void Code(unsigned char *buffer, size_t size)
Definition: AuthPacketCodec.cpp:409
Definition: AuthPacketCodec.h:20
void XorDecodeBuf(unsigned char *buffer, size_t length)
Definition: AuthPacketCodec.cpp:370
void XorCodeBuf(unsigned char *buffer, size_t length)
Definition: AuthPacketCodec.cpp:359
eDesCodeDecode
Definition: AuthPacketCodec.h:18
void Decode(unsigned char *buffer, size_t size)
Definition: AuthPacketCodec.cpp:415
void SetXorKey(int key)
Definition: AuthPacketCodec.cpp:402
Definition: AuthPacketCodec.h:21
AuthPacketCodec()
Definition: AuthPacketCodec.cpp:355
void DesCode(unsigned char *buffer, size_t size) const
Definition: AuthPacketCodec.cpp:387