From 81d588cbc751e65e10a8677480a2d6f5a117acf5 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 9 Nov 2023 21:00:51 -0500 Subject: [PATCH] sao: crypt fixes --- titles/sao/index.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/titles/sao/index.py b/titles/sao/index.py index 28da89a..1fddc0b 100644 --- a/titles/sao/index.py +++ b/titles/sao/index.py @@ -53,7 +53,7 @@ class SaoServlet(BaseServlet): self.static_hash = None if self.game_cfg.hash.verify_hash: - self.static_hash = md5(self.game_cfg.hash.hash_base) # Greate hashing guys, really validates the data + self.static_hash = md5(self.game_cfg.hash.hash_base.encode()).digest() # Greate hashing guys, really validates the data def get_endpoint_matchers(self) -> Tuple[List[Tuple[str, str, Dict]], List[Tuple[str, str, Dict]]]: return ( @@ -105,7 +105,7 @@ class SaoServlet(BaseServlet): if self.game_cfg.crypt.enable: iv = req_raw[40:48] - cipher = Blowfish.new(self.game_cfg.crypt.key, Blowfish.MODE_CBC, iv) + cipher = Blowfish.new(self.game_cfg.crypt.key.encode(), Blowfish.MODE_CBC, iv) crypt_data = req_raw[48:] req_data = cipher.decrypt(crypt_data) self.logger.debug(f"Decrypted {req_data.hex()} with IV {iv.hex()}") @@ -128,7 +128,7 @@ class SaoServlet(BaseServlet): if self.game_cfg.crypt.enable: iv = random.randbytes(8) - cipher = Blowfish.new(self.game_cfg.crypt.key, Blowfish.MODE_CBC, iv) + cipher = Blowfish.new(self.game_cfg.crypt.key.encode(), Blowfish.MODE_CBC, iv) data_crypt = cipher.encrypt(resp[24:]) resp = resp[:24] + iv + data_crypt self.logger.debug(f"Encrypted Response: {resp.hex()}")