From 0a7046d45cc3ad38e0c4c00accfa3651211f6be1 Mon Sep 17 00:00:00 2001 From: Mitja HORVAT Date: Mon, 15 Nov 2021 01:17:52 +0100 Subject: [PATCH] python: Fix `s` and `x` patterns --- python/passgeny/passgeny.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/passgeny/passgeny.py b/python/passgeny/passgeny.py index f23da94..c15fcf7 100644 --- a/python/passgeny/passgeny.py +++ b/python/passgeny/passgeny.py @@ -77,17 +77,20 @@ class Passgeny: def gen_special(match): slen = 1 if match[1] == "" else int(match[1]) - return PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))] + s = "" + for l in range(slen): + s += PASSGENY_SPECIAL[bh.modulo(len(PASSGENY_SPECIAL))] + return s def gen_decimal(match): dlen = 1 if match[1] == "" else int(match[1]) return "{}".format(bh.modulo(dlen)) def gen_hexstr(match): + xlen = 1 if match[1] == "" else int(match[1]) x = "" - for l in range(int(match[1])): + for l in range(xlen): x += "{:x}".format(bh.modulo(16)) - return x