Skip to content

Commit

Permalink
Merge pull request #2 from b3nguang/main
Browse files Browse the repository at this point in the history
修复了在python高版本下md4算法失效的问题
  • Loading branch information
moyuwa authored Feb 21, 2024
2 parents f351100 + dcec5b3 commit 1d31b80
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions genpwdhash.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/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

"""
各种哈希算法
Expand Down Expand Up @@ -37,10 +39,10 @@ def pwdsha256(password, encode='utf-8'):


def pwdntlm(password, encode='utf-8'):
# n = hashlib.new('md4', text.encode('utf-16le'))
n = hashlib.new('md4')
n.update(password.encode('utf-16le'))
return binascii.hexlify(n.digest()).decode()
md4 = MD4.new()
md4.update(password.encode(encoding=encode))
return md4.hexdigest()



def pwdmysql(password, encode='utf-8'):
Expand Down

0 comments on commit 1d31b80

Please sign in to comment.