Skip to content

Commit 7c0da3e

Browse files
committed
Update to Python 3.8
1 parent f212656 commit 7c0da3e

File tree

4 files changed

+15
-309
lines changed

4 files changed

+15
-309
lines changed

pwm.default.setting

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"Algorithm": "md5",
3-
"CharacterSet": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
4-
"LeetLvl": 1,
5-
"Length": 8,
6-
"Modifier": "",
7-
"Prefix": "",
8-
"Suffix": "",
9-
"URL": "",
10-
"UseLeet": "none",
2+
"Algorithm": "md5",
3+
"CharacterSet": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
4+
"LeetLvl": 1,
5+
"Length": 8,
6+
"Modifier": "",
7+
"Prefix": "",
8+
"Suffix": "",
9+
"URL": "",
10+
"UseLeet": "none",
1111
"Username": ""
1212
}

pwmlib.py

+4-29
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
try:
6060
# Do we have pycrypto ? <http://www.amk.ca/python/code/crypto>
61-
from Crypto.Hash import MD4, SHA256, RIPEMD
61+
from Crypto.Hash import SHA256
6262
HAS_CRYPTO = True
6363
except ImportError:
6464
HAS_CRYPTO = False
@@ -94,12 +94,8 @@
9494
}
9595

9696
CRYPTO_ALGORITHM_2_HASH_FUNC = {
97-
"md4": "any_md4",
98-
"hmac-md4": "any_hmac_md4",
9997
"sha256": "any_sha256",
10098
"hmac-sha256": "any_hmac_sha256",
101-
"rmd160": "any_rmd160",
102-
"hmac-rmd160": "any_hmac_rmd160",
10399
}
104100

105101
if HAS_HASHLIB:
@@ -123,8 +119,7 @@ class PwmHashUtils(object):
123119
* algorithm: String
124120
\tOne valid algorithm out of "md5", "hmac-md5", "sha1", "hmac-sha1"
125121
\tIf hashlib is present also out of "sha256", "hmac-sha256"
126-
\tIf pycrypto is present also out of "md4", "hmac-md4", "sha256",
127-
\t"hmac-sha256", "rmd160", "hmac-rmd160"
122+
\tIf pycrypto is present also out of "sha256", "hmac-sha256"
128123
* encoding: String
129124
\tCharacters that may appear in the generated password
130125
@@ -264,26 +259,6 @@ def any_hmac_sha256(self, key, inp, trim=True):
264259
hashfunc = SHA256
265260
return self.rstr2any(hmac.new(key, inp, hashfunc).digest(), trim)
266261

267-
def any_md4(self, inp, trim=True):
268-
"""MD4 function wrapper"""
269-
270-
return self.rstr2any(MD4.new(inp).digest(), trim)
271-
272-
def any_hmac_md4(self, key, inp, trim=True):
273-
"""MD4 HMAC function wrapper"""
274-
275-
return self.rstr2any(hmac.new(key, inp, MD4).digest(), trim)
276-
277-
def any_rmd160(self, inp, trim=True):
278-
"""RMD160 function wrapper"""
279-
280-
return self.rstr2any(RIPEMD.new(inp).digest(), trim)
281-
282-
def any_hmac_rmd160(self, key, inp, trim=True):
283-
"""RMD160 HMAC function wrapper"""
284-
285-
return self.rstr2any(hmac.new(key, inp, RIPEMD).digest(), trim)
286-
287262

288263
@attr.s
289264
class PwmSettings(object):
@@ -305,8 +280,8 @@ class PwmSettings(object):
305280
metadata=_mpw_metadata)
306281

307282
_alg_metadata = {'cmd1': "-a", 'cmd2': "--alg", "guitext": "Algorithm",
308-
"help": "Hash algorithm [hmac-] md4/md5/sha1/sha256/"
309-
"rmd160 (default md5)"}
283+
"help": "Hash algorithm [hmac-] md5/sha1/sha256/"
284+
" (default md5)"}
310285
Algorithm = attr.ib(default="md5", validator=algorithm_val, type="alg",
311286
metadata=_alg_metadata)
312287

test_pwmlib_compare.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def _generatepassword(self,
8080
def _get_cmd_args(self, params):
8181
"""Returns command line arguments for given paramters"""
8282

83-
args = ["passwordmaker"]
83+
args = ["./passwordmaker.py"]
8484

85-
halg = params["hashAlgorithm"].upper().replace("RMD160", "RIPEMD160")
85+
halg = params["hashAlgorithm"].upper()
8686
if "HMAC-" in halg:
8787
args.append("--HMAC")
8888
halg = halg[5:]

testpwmlib.py

-269
This file was deleted.

0 commit comments

Comments
 (0)