From af5c37edd607f678617713ec3b409300b6ab8265 Mon Sep 17 00:00:00 2001 From: ColdWindScholar <3590361911@qq.com> Date: Sat, 4 May 2024 13:43:30 +0800 Subject: [PATCH] Optimize code for cryptutils.py --- mtkclient/Library/cryptutils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mtkclient/Library/cryptutils.py b/mtkclient/Library/cryptutils.py index b6fefd3..d3a386c 100755 --- a/mtkclient/Library/cryptutils.py +++ b/mtkclient/Library/cryptutils.py @@ -76,7 +76,8 @@ class cryptutils: class aes: # GF(2^128) defined by 1 + a + a^2 + a^7 + a^128 # Please note the MSB is x0 and LSB is x127 - def gf_2_128_mul(self, x, y): + @staticmethod + def gf_2_128_mul(x, y): assert x < (1 << 128) assert y < (1 << 128) res = 0 @@ -367,7 +368,8 @@ class cryptutils: x = bytes.fromhex(h) return b'\x00' * int(x_len - len(x)) + x - def os2ip(self, x): + @staticmethod + def os2ip(x): """Converts the byte string x representing an integer reprented using the big-endian convient to an integer. """