summaryrefslogtreecommitdiff
path: root/src/pso/PSOV3EncryptionTCP.cpp
blob: 737c5103d2aeca4ce5befebd76d28ee56763635b (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
29
#include <global_types.h>
#include <string.h>
#include "pso/macros.h"
#include "pso/PSOV3EncryptionTCP.h"
#include "pso/TArray.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);
}