summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-02-28 10:45:56 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-02-28 10:45:56 -0400
commitf6c047795d651962374fcb20d37359c763aeb9c8 (patch)
treef90b4649b1a4fbaf5cec491462157d8dbc1020c6 /src
parent9326e63440b08f877302a87afbe1ef82d5cd2c76 (diff)
PSOV3EncryptionTCP: Add, and fully match `PSOV3EncryptionTCP`
That was way easier than I expected, I thought it'd take a lot longer than this.
Diffstat (limited to 'src')
-rw-r--r--src/pso/PSOV3EncryptionTCP.cpp29
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);
+}
+