diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pso/PSOV3EncryptionTCP.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
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 <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); +} + |