SEGS  0.6.1-develop [3e741b81]
Super Entity Game Server
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 - 2019 SEGS Team (see AUTHORS.md)
5  * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md 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 SetDesKey(uint64_t key)
Definition: AuthPacketCodec.cpp:345
Definition: AuthPacketCodec.h:13
Definition: AuthPacketCodec.h:24
~AuthPacketCodec()
Definition: AuthPacketCodec.h:28
void Code(unsigned char *buffer, size_t size)
Definition: AuthPacketCodec.cpp:407
Definition: AuthPacketCodec.h:20
void DesCode(unsigned char *buffer, size_t size) const
Definition: AuthPacketCodec.cpp:385
void XorDecodeBuf(unsigned char *buffer, size_t length)
Definition: AuthPacketCodec.cpp:368
void XorCodeBuf(unsigned char *buffer, size_t length)
Definition: AuthPacketCodec.cpp:357
void DesDecode(unsigned char *buffer, size_t size) const
Definition: AuthPacketCodec.cpp:419
eDesCodeDecode
Definition: AuthPacketCodec.h:18
void Decode(unsigned char *buffer, size_t size)
Definition: AuthPacketCodec.cpp:413
void SetXorKey(int key)
Definition: AuthPacketCodec.cpp:400
Definition: AuthPacketCodec.h:21
AuthPacketCodec()
Definition: AuthPacketCodec.cpp:353