diff --git a/python/passgeny/passgeny.py b/python/passgeny/passgeny.py index 1ae0299..42a5e8c 100644 --- a/python/passgeny/passgeny.py +++ b/python/passgeny/passgeny.py @@ -81,10 +81,8 @@ class Passgeny: return PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))] def gen_decimal(match): - return "{}".format(bh.modulo(int(match[1]))) - - def gen_hex(match): - return "{:x}".format(bh.modulo(int(match[1]))) + dlen = 1 if match[1] == "" else int(match[1]) + return "{}".format(bh.modulo(dlen)) def gen_hexstr(match): x = "" @@ -103,8 +101,7 @@ class Passgeny: [ '([0-9]*)p', gen_phogen ], [ '([0-9]*)s', gen_special ], [ '([0-9]+)d', gen_decimal ], - [ '([0-9]+)x', gen_hex ], - [ '([0-9]+)X', gen_hexstr ], + [ '([0-9]+)x', gen_hexstr ], [ '\^', gen_capitalize ], ]