From d4b2c48804a658caa86631d5738151fa49552f9a Mon Sep 17 00:00:00 2001 From: 6time <31231318+moyuwa@users.noreply.github.com> Date: Wed, 6 Mar 2024 09:23:26 +0000 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BF=AE=E5=A4=8D=E4=BA=86=E5=9C=A8p?= =?UTF-8?q?ython=E9=AB=98=E7=89=88=E6=9C=AC=E4=B8=8Bmd4=E7=AE=97=E6=B3=95?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genpwdhash.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/genpwdhash.py b/genpwdhash.py index 682ada3..b6d6a72 100644 --- a/genpwdhash.py +++ b/genpwdhash.py @@ -1,13 +1,11 @@ #!/usr/bin/env python3 # coding=utf-8 # python version 3.7 by 6time -# fixed by b3nguang # 生成密码的各种哈希 import hashlib, binascii, sqlite3, base64 import config1 from gmssl import sm3, func -from Crypto.Hash import MD4 """ 各种哈希算法 @@ -39,10 +37,10 @@ def pwdsha256(password, encode='utf-8'): def pwdntlm(password, encode='utf-8'): - md4 = MD4.new() - md4.update(password.encode(encoding=encode)) - return md4.hexdigest() - + # n = hashlib.new('md4', text.encode('utf-16le')) + n = hashlib.new('md4') + n.update(password.encode('utf-16le')) + return binascii.hexlify(n.digest()).decode() def pwdmysql(password, encode='utf-8'):