From ae55b6e02c45d394569ad02b6ad78d9d0c011ca6 Mon Sep 17 00:00:00 2001 From: Caohongtao Date: Fri, 8 Aug 2025 10:00:40 +0000 Subject: [PATCH] fix some spell bugs and param type Signed-off-by: Caohongtao --- tools/ca_auth_hash_tools/calc_ca_caller_hash.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/ca_auth_hash_tools/calc_ca_caller_hash.py b/tools/ca_auth_hash_tools/calc_ca_caller_hash.py index 3db2d84..61d16c9 100644 --- a/tools/ca_auth_hash_tools/calc_ca_caller_hash.py +++ b/tools/ca_auth_hash_tools/calc_ca_caller_hash.py @@ -83,14 +83,14 @@ def check_exponent_type(value): def calc_sha256(buf): - """ calcuate sha256 """ + """ calculate sha256 """ hash_op = hashlib.sha256() hash_op.update(buf) return hash_op.digest() def calc_cmdline_uid_hash(cmdline, uid): - """ calcuate cmdline||uid hash """ + """ calculate cmdline||uid hash """ c_uid = c_uint32(uid) c_str = create_string_buffer(cmdline.encode('utf-8'), len(cmdline) + sizeof(c_uid)) memmove(byref(c_str, len(c_str.value)), byref(c_uid), sizeof(c_uid)) @@ -98,13 +98,13 @@ def calc_cmdline_uid_hash(cmdline, uid): def calc_cmdline_username_hash(cmdline, username): - """ calcuate cmdline||username hash """ + """ calcluate cmdline||username hash """ c_str = create_string_buffer((cmdline + username).encode('utf-8'), len(cmdline) + MAX_USERNAME_LEN) return calc_sha256(c_str) def calc_apk_caller_hash(apk_pkg_name, apk_modulus, apk_public_exponent): - """ calcuate pkg_name||modulus||exponent hash """ + """ calculate pkg_name||modulus||exponent hash """ hex_modulus = binascii.a2b_hex(apk_modulus) hex_exponent = binascii.a2b_hex(apk_public_exponent) pub_key_format = "{}s{}s".format(len(hex_modulus), len(hex_exponent)) @@ -130,7 +130,7 @@ def handle_cmdline_uid_item_hash(item): else: raise RuntimeError("invalid item attr", attr) caller_hash = calc_cmdline_uid_hash(cmdline, uid) - logging.info("cmdline: %s, uid: %s", cmdline, uid) + logging.info("cmdline: %s, uid: %d", cmdline, uid) print_hash(caller_hash) -- Gitee