ReplicaNet and RNLobby  1
Encryption.h
1 /* START_LICENSE_HEADER
2 
3 Copyright (C) 2000 Martin Piper, original design and program code
4 Copyright (C) 2001 Replica Software
5 
6 This program file is copyright (C) Replica Software and can only be used under license.
7 For more information visit: http://www.replicanet.com/
8 Or email: info@replicanet.com
9 
10 END_LICENSE_HEADER */
11 #include "RNPlatform/Inc/MemoryTracking.h"
12 #ifndef __ENCRYPTION_H__
13 #define __ENCRYPTION_H__
14 
15 namespace RNReplicaNet
16 {
17 
18 // Key length must be an integer multiple of 4 and be at least 8
19 const int kEncryptionKeyLengthBytes = 8;
20 
25 {
26 public:
27  struct Key
28  {
29  public:
30  Key();
31  Key(const Key &source);
32  virtual ~Key();
33 
39  void Create(const void *data,const int length);
40 
46  void AddCrypto(const void *data,const int length);
47 
48  void AddCrypto(const unsigned char salt);
49 
50  unsigned char mKey[kEncryptionKeyLengthBytes];
51  };
52 
59  static void Encrypt(void *data,int length,Key *key);
60 
67  static void Decrypt(void *data,int length,Key *key);
68 
69 
76  static void CommutativeEncrypt(void *data,int length,Key *key);
77 
84  static void CommutativeDecrypt(void *data,int length,Key *key);
85 
92  static void CommutativeEncryptBytewise(void *data,int length,Key *key);
93 
100  static void CommutativeDecryptBytewise(void *data,int length,Key *key);
101 };
102 
103 } // namespace RNReplicaNet
104 
105 #endif
Definition: Encryption.h:24
Definition: Encryption.h:27
static void CommutativeEncryptBytewise(void *data, int length, Key *key)
static void Encrypt(void *data, int length, Key *key)
static void CommutativeDecrypt(void *data, int length, Key *key)
static void CommutativeDecryptBytewise(void *data, int length, Key *key)
void Create(const void *data, const int length)
static void Decrypt(void *data, int length, Key *key)
void AddCrypto(const void *data, const int length)
static void CommutativeEncrypt(void *data, int length, Key *key)