TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PacketCrypt.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef _PACKETCRYPT_H
19 #define _PACKETCRYPT_H
20 
21 #include "Cryptography/ARC4.h"
22 
23 class BigNumber;
24 
26 {
27  public:
28  PacketCrypt(uint32 rc4InitSize);
29  virtual ~PacketCrypt() { }
30 
31  virtual void Init(BigNumber* K) = 0;
32  void DecryptRecv(uint8* data, size_t length);
33  void EncryptSend(uint8* data, size_t length);
34 
35  bool IsInitialized() const { return _initialized; }
36 
37  protected:
41 };
42 
43 #endif // _PACKETCRYPT_H
Definition: BigNumber.h:28
bool _initialized
Definition: PacketCrypt.h:40
Definition: PacketCrypt.h:25
Definition: ARC4.h:25
uint32_t uint32
Definition: Define.h:150
ARC4 _serverEncrypt
Definition: PacketCrypt.h:39
#define TC_COMMON_API
Definition: Define.h:116
float length(float v)
Definition: vectorMath.h:208
ARC4 _clientDecrypt
Definition: PacketCrypt.h:38
uint8_t uint8
Definition: Define.h:152
virtual ~PacketCrypt()
Definition: PacketCrypt.h:29
bool IsInitialized() const
Definition: PacketCrypt.h:35