58
58
59
59
try :
60
60
# 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
62
62
HAS_CRYPTO = True
63
63
except ImportError :
64
64
HAS_CRYPTO = False
94
94
}
95
95
96
96
CRYPTO_ALGORITHM_2_HASH_FUNC = {
97
- "md4" : "any_md4" ,
98
- "hmac-md4" : "any_hmac_md4" ,
99
97
"sha256" : "any_sha256" ,
100
98
"hmac-sha256" : "any_hmac_sha256" ,
101
- "rmd160" : "any_rmd160" ,
102
- "hmac-rmd160" : "any_hmac_rmd160" ,
103
99
}
104
100
105
101
if HAS_HASHLIB :
@@ -123,8 +119,7 @@ class PwmHashUtils(object):
123
119
* algorithm: String
124
120
\t One valid algorithm out of "md5", "hmac-md5", "sha1", "hmac-sha1"
125
121
\t If hashlib is present also out of "sha256", "hmac-sha256"
126
- \t If pycrypto is present also out of "md4", "hmac-md4", "sha256",
127
- \t "hmac-sha256", "rmd160", "hmac-rmd160"
122
+ \t If pycrypto is present also out of "sha256", "hmac-sha256"
128
123
* encoding: String
129
124
\t Characters that may appear in the generated password
130
125
@@ -264,26 +259,6 @@ def any_hmac_sha256(self, key, inp, trim=True):
264
259
hashfunc = SHA256
265
260
return self .rstr2any (hmac .new (key , inp , hashfunc ).digest (), trim )
266
261
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
-
287
262
288
263
@attr .s
289
264
class PwmSettings (object ):
@@ -305,8 +280,8 @@ class PwmSettings(object):
305
280
metadata = _mpw_metadata )
306
281
307
282
_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)" }
310
285
Algorithm = attr .ib (default = "md5" , validator = algorithm_val , type = "alg" ,
311
286
metadata = _alg_metadata )
312
287
0 commit comments