aboutsummaryrefslogtreecommitdiff
path: root/server/fantacrypt.py
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2018-11-10 23:15:54 -0600
committeroldmud0 <oldmud0@users.noreply.github.com>2018-11-10 23:15:54 -0600
commitde348c22d5f1287cc38734e6e3b77fc492629721 (patch)
treea0c57e47c29404ce1312bebf9528fdf0c62b2615 /server/fantacrypt.py
parent56ec03a23a0f687b79d3ce324e517563a41c0032 (diff)
Coalesce server changes into patch file (this is not a monorepo)
Diffstat (limited to 'server/fantacrypt.py')
-rw-r--r--server/fantacrypt.py45
1 files changed, 0 insertions, 45 deletions
diff --git a/server/fantacrypt.py b/server/fantacrypt.py
deleted file mode 100644
index e31548e..0000000
--- a/server/fantacrypt.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# tsuserver3, an Attorney Online server
-#
-# Copyright (C) 2016 argoneus <argoneuscze@gmail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# fantacrypt was a mistake, just hardcoding some numbers is good enough
-
-import binascii
-
-CRYPT_CONST_1 = 53761
-CRYPT_CONST_2 = 32618
-CRYPT_KEY = 5
-
-
-def fanta_decrypt(data):
- data_bytes = [int(data[x:x + 2], 16) for x in range(0, len(data), 2)]
- key = CRYPT_KEY
- ret = ''
- for byte in data_bytes:
- val = byte ^ ((key & 0xffff) >> 8)
- ret += chr(val)
- key = ((byte + key) * CRYPT_CONST_1) + CRYPT_CONST_2
- return ret
-
-
-def fanta_encrypt(data):
- key = CRYPT_KEY
- ret = ''
- for char in data:
- val = ord(char) ^ ((key & 0xffff) >> 8)
- ret += binascii.hexlify(val.to_bytes(1, byteorder='big')).decode().upper()
- key = ((val + key) * CRYPT_CONST_1) + CRYPT_CONST_2
- return ret