From f6c047795d651962374fcb20d37359c763aeb9c8 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 28 Feb 2023 10:45:56 -0400 Subject: PSOV3EncryptionTCP: Add, and fully match `PSOV3EncryptionTCP` That was way easier than I expected, I thought it'd take a lot longer than this. --- src/pso/PSOV3EncryptionTCP.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/pso/PSOV3EncryptionTCP.cpp (limited to 'src') diff --git a/src/pso/PSOV3EncryptionTCP.cpp b/src/pso/PSOV3EncryptionTCP.cpp new file mode 100644 index 0000000..737c510 --- /dev/null +++ b/src/pso/PSOV3EncryptionTCP.cpp @@ -0,0 +1,29 @@ +#include +#include +#include "pso/macros.h" +#include "pso/PSOV3EncryptionTCP.h" +#include "pso/TArray.h" + +void PSOV3EncryptionTCP::encrypt(void *void_data, int size) { + u32 *data = reinterpret_cast(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); +} + -- cgit v1.2.3-13-gbd6f