BF2MC-Matchmaker
sb_crypt.h
1 // File: sb_crypt.h
3 // SDK: GameSpy Server Browsing SDK
4 //
5 // Copyright Notice: This file is part of the GameSpy SDK designed and
6 // developed by GameSpy Industries. Copyright (c) 2009 GameSpy Industries, Inc.
7 
8 #ifndef _SB_CRYPT_H
9 #define _SB_CRYPT_H
10 
11 
12 typedef struct _GOACryptState
13 {
14  unsigned char cards[256]; // A permutation of 0-255.
15  unsigned char rotor; // Index that rotates smoothly
16  unsigned char ratchet; // Index that moves erratically
17  unsigned char avalanche; // Index heavily data dependent
18  unsigned char last_plain; // Last plain text byte
19  unsigned char last_cipher; // Last cipher text byte
21 
22 
23 
24 void GOACryptInit(GOACryptState *state, unsigned char *key, unsigned char keysize);
25 void GOAHashInit(GOACryptState *state);
26 unsigned char GOAEncryptByte(GOACryptState *state, unsigned char b); // Encrypt byte
27 void GOAEncrypt(GOACryptState *state, unsigned char *bp, size_t len); // Encrypt byte array
28 unsigned char GOADecryptByte(GOACryptState *state, unsigned char b); // Decrypt byte.
29 void GOADecrypt(GOACryptState *state,unsigned char *bp, size_t len); // decrypt byte array
30 void GOAHashFinal(GOACryptState *state, unsigned char *hash, unsigned char hashlength); // Hash length (16-32)
31 
32 #endif