Browse Source

minor fixes and changes

The MMGen Project 5 years ago
parent
commit
9c603be62b
3 changed files with 8 additions and 9 deletions
  1. 0 1
      mmgen/globalvars.py
  2. 5 5
      mmgen/util.py
  3. 3 3
      test/unit_tests_d/ut_baseconv.py

+ 0 - 1
mmgen/globalvars.py

@@ -152,7 +152,6 @@ class g(object):
 		'hidden_incog_input_params','in_fmt'
 	)
 	incompatible_opts = (
-		('base32','hex'), # mmgen-passgen
 		('bob','alice'),
 		('quiet','verbose'),
 		('label','keep_label'),

+ 5 - 5
mmgen/util.py

@@ -346,14 +346,14 @@ class baseconv(object):
 	@classmethod
 	def get_pad(cls,pad,seed_pad_func):
 		"""
-		'pad' argument to applicable baseconv methods must be either None, 'seed' or an integer.
+		'pad' argument to baseconv conversion methods must be either None, 'seed' or an integer.
 		If None, output of minimum (but never zero) length will be produced.
-		If 'seed', output length will be mapped from input length using seed_pad_lens.
+		If 'seed', output length will be mapped from input length using data in seed_pad_lens.
 		If an integer, it refers to the minimum allowable *string length* of the output.
 		"""
 		if pad == None:
 			return 0
-		elif isinstance(pad,int) and type(pad) != bool:
+		elif type(pad) == int:
 			return pad
 		elif pad == 'seed':
 			return seed_pad_func()
@@ -363,7 +363,7 @@ class baseconv(object):
 
 	@classmethod
 	def tohex(cls,words_arg,wl_id,pad=None):
-		"convert string or list data of base specified by 'wl_id' to hex string"
+		"convert string or list data of base 'wl_id' to hex string"
 
 		words = words_arg if isinstance(words_arg,(list,tuple)) else tuple(words_arg.strip())
 
@@ -392,7 +392,7 @@ class baseconv(object):
 
 	@classmethod
 	def fromhex(cls,hexstr,wl_id,pad=None,tostr=False):
-		"convert hex string to list or string data of base specified by 'wl_id'"
+		"convert hex string to list or string data of base 'wl_id'"
 		if wl_id in ('mmgen','tirosh','bip39'):
 			assert tostr == False,"'tostr' must be False for '{}'".format(wl_id)
 

+ 3 - 3
test/unit_tests_d/ut_baseconv.py

@@ -120,7 +120,7 @@ class unit_test(object):
 			for (hexstr,pad),ret_chk in data:
 				ret = baseconv.fromhex(hexstr,wl_id=base,pad=pad,tostr=True)
 				if pad != 'seed':
-					assert len(ret) >= (pad or 0), perr.format(ret,pad)
+					assert len(ret) >= (pad or 0), perr.format(ret,pad or 0)
 				assert ret == ret_chk, rerr.format(ret,ret_chk)
 				vmsg(fs.format(h=hexstr,r=ret,p=str(pad)))
 #				msg("(('{h}',{p}),'{r}'),".format(h=hexstr,r=ret,c=ret_chk,p=pad))
@@ -137,9 +137,9 @@ class unit_test(object):
 					pad = len(hexstr)
 				ret = baseconv.tohex(ret_chk,wl_id=base,pad=pad)
 				if pad == None:
-					assert int(ret,16) == int(hexstr,16), rerr.format(ret,ret_chk)
+					assert int(ret,16) == int(hexstr,16), rerr.format(int(ret,16),int(hexstr,16))
 				else:
-					assert ret == hexstr, rerr.format(ret,ret_chk)
+					assert ret == hexstr, rerr.format(ret,hexstr)
 				vmsg(fs.format(h=ret_chk,r=ret,p=str(pad)))
 #				msg("(('{h}',{p}),'{r}'),".format(h=hexstr,r=ret_chk,c=ret_chk,p=pad))