Skip to content

Commit

Permalink
Merge pull request #26 from gloriousacg/main
Browse files Browse the repository at this point in the history
简洁的MD5计算方法
  • Loading branch information
HisAtri authored Feb 29, 2024
2 parents 314414b + 5c33cef commit 2bda309
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


# 跟踪重定向
Expand Down

0 comments on commit 2bda309

Please sign in to comment.