aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorscatterflower <marisaposs@gameboyprinter.moe>2020-08-21 15:30:54 -0500
committerscatterflower <marisaposs@gameboyprinter.moe>2020-08-21 15:30:54 -0500
commitc0316ded85bbd2098fd51775632ad4c12be95cb9 (patch)
treecb8f0698751d24f1c31d0f7d1a83f1bcee6b7e50 /src
parent2c6a690d47ca0c48bef84b3d28d58064365a9934 (diff)
remove fantacrypt
Diffstat (limited to 'src')
-rw-r--r--src/aopacket.cpp18
-rw-r--r--src/encryption_functions.cpp58
-rw-r--r--src/hex_functions.cpp17
-rw-r--r--src/packet_distribution.cpp20
4 files changed, 1 insertions, 112 deletions
diff --git a/src/aopacket.cpp b/src/aopacket.cpp
index 6afd39e7..1cb54280 100644
--- a/src/aopacket.cpp
+++ b/src/aopacket.cpp
@@ -31,24 +31,8 @@ QString AOPacket::to_string()
f_string += "#%";
- if (encrypted)
- return "#" + f_string;
- else
- return f_string;
-}
-
-void AOPacket::encrypt_header(unsigned int p_key)
-{
- m_header = fanta_encrypt(m_header, p_key);
-
- encrypted = true;
-}
-
-void AOPacket::decrypt_header(unsigned int p_key)
-{
- m_header = fanta_decrypt(m_header, p_key);
- encrypted = false;
+ return f_string;
}
void AOPacket::net_encode()
diff --git a/src/encryption_functions.cpp b/src/encryption_functions.cpp
deleted file mode 100644
index 6669fe15..00000000
--- a/src/encryption_functions.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "encryption_functions.h"
-
-#include "hex_functions.h"
-
-QString fanta_encrypt(QString temp_input, unsigned int p_key)
-{
- // using standard stdlib types is actually easier here because of implicit
- // char<->int conversion which in turn makes encryption arithmetic easier
-
- unsigned int key = p_key;
- unsigned int C1 = 53761;
- unsigned int C2 = 32618;
-
- QVector<uint_fast8_t> temp_result;
- std::string input = temp_input.toUtf8().constData();
-
- for (unsigned int pos = 0; pos < input.size(); ++pos) {
- uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256;
- temp_result.append(output);
- key = (temp_result.at(pos) + key) * C1 + C2;
- }
-
- std::string result = "";
-
- for (uint_fast8_t i_int : temp_result) {
- result += omni::int_to_hex(i_int);
- }
-
- QString final_result = QString::fromStdString(result);
-
- return final_result;
-}
-
-QString fanta_decrypt(QString temp_input, unsigned int key)
-{
- std::string input = temp_input.toUtf8().constData();
-
- QVector<unsigned int> unhexed_vector;
-
- for (unsigned int i = 0; i < input.length(); i += 2) {
- std::string byte = input.substr(i, 2);
- unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16);
- unhexed_vector.append(hex_int);
- }
-
- unsigned int C1 = 53761;
- unsigned int C2 = 32618;
-
- std::string result = "";
-
- for (int pos = 0; pos < unhexed_vector.size(); ++pos) {
- unsigned char output = unhexed_vector.at(pos) ^ (key >> 8) % 256;
- result += output;
- key = (unhexed_vector.at(pos) + key) * C1 + C2;
- }
-
- return QString::fromStdString(result);
-}
diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp
deleted file mode 100644
index 1e35718f..00000000
--- a/src/hex_functions.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "hex_functions.h"
-
-namespace omni {
-std::string int_to_hex(unsigned int input)
-{
- if (input > 255)
- return "FF";
-
- std::stringstream stream;
- stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex
- << input;
- std::string result(stream.str());
- std::transform(result.begin(), result.end(), result.begin(), ::toupper);
-
- return result;
-}
-} // namespace omni
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index e4e5d5c2..96d54b53 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -120,11 +120,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (f_contents.size() == 0)
goto end;
- // you may ask where 322 comes from. that would be a good question.
- s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt();
-
// default(legacy) values
- encryption_needed = true;
yellow_text_enabled = false;
prezoom_enabled = false;
flipping_enabled = false;
@@ -140,10 +136,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
additive_enabled = false;
effects_enabled = false;
- // workaround for tsuserver4
- if (f_contents.at(0) == "NOENCRYPT")
- encryption_needed = false;
-
QString f_hdid;
f_hdid = get_hdid();
@@ -201,8 +193,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
custom_objection_enabled = true;
if (f_packet.contains("fastloading", Qt::CaseInsensitive))
improved_loading_enabled = true;
- if (f_packet.contains("noencryption", Qt::CaseInsensitive))
- encryption_needed = false;
if (f_packet.contains("deskmod", Qt::CaseInsensitive))
desk_mod_enabled = true;
if (f_packet.contains("evidence", Qt::CaseInsensitive))
@@ -750,19 +740,9 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded)
QString f_packet = p_packet->to_string();
- if (encryption_needed) {
-#ifdef DEBUG_NETWORK
- qDebug() << "S(e):" << f_packet;
-#endif
-
- p_packet->encrypt_header(s_decryptor);
- f_packet = p_packet->to_string();
- }
- else {
#ifdef DEBUG_NETWORK
qDebug() << "S:" << f_packet;
#endif
- }
net_manager->ship_server_packet(f_packet);