From 5c33cefe01731d1633a69e5182748f21e45d2c01 Mon Sep 17 00:00:00 2001 From: Yao Lin <161695362+gloriousacg@users.noreply.github.com> Date: Thu, 29 Feb 2024 17:00:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E6=B4=81=E7=9A=84MD5=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 7205b15..874b627 100644 --- a/app.py +++ b/app.py @@ -57,11 +57,11 @@ def calculate_md5(string): # 将字符串转换为字节流并进行 MD5 计算 md5_hash.update(string.encode('utf-8')) - # 获取计算结果的十六进制表示,并去掉开头的 "0x" - md5_hex = md5_hash.hexdigest() - md5_hex = md5_hex.lstrip("0x") + # 获取计算结果的十六进制表示 + md5_bytes = md5_hash.digest() + md5_str = md5_bytes.hex() - return md5_hex + return md5_str # 跟踪重定向