From 8d190ce7f0f9525b17c5ffbb0e73fd17d2d2af03 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 9 Nov 2023 21:05:30 -0500 Subject: [PATCH] sao: fix padding --- titles/sao/index.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/titles/sao/index.py b/titles/sao/index.py index 1fddc0b..ce5b826 100644 --- a/titles/sao/index.py +++ b/titles/sao/index.py @@ -128,8 +128,12 @@ class SaoServlet(BaseServlet): if self.game_cfg.crypt.enable: iv = random.randbytes(8) + data_to_crypt = resp[24:] + while len(data_to_crypt) % 8 != 0: + data_to_crypt += b"\x00" + cipher = Blowfish.new(self.game_cfg.crypt.key.encode(), Blowfish.MODE_CBC, iv) - data_crypt = cipher.encrypt(resp[24:]) + data_crypt = cipher.encrypt(data_to_crypt) resp = resp[:24] + iv + data_crypt self.logger.debug(f"Encrypted Response: {resp.hex()}")