mirror of
https://github.com/GAM-team/GAM.git
synced 2026-06-28 09:51:36 +00:00
passlib 1.7.1
This commit is contained in:
@@ -34,8 +34,8 @@ warn("the 'passlib.win32' module is deprecated, and will be removed in "
|
||||
from binascii import hexlify
|
||||
# site
|
||||
# pkg
|
||||
from passlib.utils.compat import b, unicode
|
||||
from passlib.utils.des import des_encrypt_block
|
||||
from passlib.utils.compat import unicode
|
||||
from passlib.crypto.des import des_encrypt_block
|
||||
from passlib.hash import nthash
|
||||
# local
|
||||
__all__ = [
|
||||
@@ -46,7 +46,7 @@ __all__ = [
|
||||
#=============================================================================
|
||||
# helpers
|
||||
#=============================================================================
|
||||
LM_MAGIC = b("KGS!@#$%")
|
||||
LM_MAGIC = b"KGS!@#$%"
|
||||
|
||||
raw_nthash = nthash.raw_nthash
|
||||
|
||||
@@ -59,7 +59,7 @@ def raw_lmhash(secret, encoding="ascii", hex=False):
|
||||
# from being made w/o user explicitly choosing an encoding.
|
||||
if isinstance(secret, unicode):
|
||||
secret = secret.encode(encoding)
|
||||
ns = secret.upper()[:14] + b("\x00") * (14-len(secret))
|
||||
ns = secret.upper()[:14] + b"\x00" * (14-len(secret))
|
||||
out = des_encrypt_block(ns[:7], LM_MAGIC) + des_encrypt_block(ns[7:], LM_MAGIC)
|
||||
return hexlify(out).decode("ascii") if hex else out
|
||||
|
||||
|
||||
Reference in New Issue
Block a user