aboutsummaryrefslogtreecommitdiff
path: root/server/src/util
diff options
context:
space:
mode:
authoralpine <[email protected]>2020-06-15 21:34:40 +0200
committeralpine <[email protected]>2020-06-15 21:34:40 +0200
commit19583bfb75d4a15a75d70355dd3b752bfc1d8b03 (patch)
tree868211249e0d4011e06bef6a879f462053d3c745 /server/src/util
parentClient. (diff)
downloadloader-19583bfb75d4a15a75d70355dd3b752bfc1d8b03.tar.xz
loader-19583bfb75d4a15a75d70355dd3b752bfc1d8b03.zip
Removed xor as it was slowing down everything alot.
Finished file/message streaming, really fast.
Diffstat (limited to 'server/src/util')
-rw-r--r--server/src/util/xor.cpp39
-rw-r--r--server/src/util/xor.h12
2 files changed, 0 insertions, 51 deletions
diff --git a/server/src/util/xor.cpp b/server/src/util/xor.cpp
deleted file mode 100644
index a00ecc9..0000000
--- a/server/src/util/xor.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "../include.h"
-#include "xor.h"
-
-char enc::gen_key() {
- std::random_device r;
-
- std::default_random_engine e1(r());
- std::uniform_real_distribution<> uniform_dist(0, 255);
- return static_cast<char>(uniform_dist(e1));
-}
-
-void enc::encrypt_message(std::string &str) {
- std::array<char, key_len> keys;
- for (size_t i = 0; i < key_len; i++) {
- keys[i] = gen_key();
- str.insert(str.end(), keys[i]);
- }
-
- for (auto &key : keys) {
- for (size_t i = 0; i < str.size() - key_len; i++) {
- str[i] ^= key;
- }
- }
-}
-
-void enc::decrypt_message(std::string &str) {
- if (str.size() <= key_len) return;
-
- std::string keys = str.substr(0, key_len);
- std::reverse(keys.begin(), keys.end());
-
- for (auto &key : keys) {
- for (size_t i = key_len; i < str.size(); i++) {
- str[i] ^= key;
- }
- }
-
- str.erase(str.begin(), str.begin() + key_len);
-} \ No newline at end of file
diff --git a/server/src/util/xor.h b/server/src/util/xor.h
deleted file mode 100644
index 7180945..0000000
--- a/server/src/util/xor.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#pragma once
-
-namespace enc {
-constexpr size_t key_len = 50;
-
-char gen_key();
-
-void encrypt_message(std::string &str);
-
-void decrypt_message(std::string &str);
-
-} // namespace enc \ No newline at end of file