summaryrefslogtreecommitdiff
path: root/src/pso/PSOV3EncryptionTCP.cpp
blob: d688b8de2d18f52aafad0701e783697a5528de12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <global_types.h>
#include <string.h>
#include "pso/macros.h"
#include "pso/PSOV3EncryptionTCP.h"

void PSOV3EncryptionTCP::encrypt(void *void_data, int size) {
	u32 *data = reinterpret_cast<u32 *>(void_data);
	size = (size + 3) / 4;
	for (int i = 0; i < size; ++i) {
		bswap_32(&data[i]);
		data[i] ^= next();
		bswap_32(&data[i]);
	}
}

void PSOV3EncryptionTCP::reset(u32 seed) {
	m_seed = seed;
	init(seed);
}

PSOV3EncryptionTCP::~PSOV3EncryptionTCP() {

}

PSOV3EncryptionTCP::PSOV3EncryptionTCP() : PSOV3Encryption() {
	reset(0);
}