comparison cutils/genpwd.py @ 233:5f4c81313be7

Assert that the generated password has the required (output) length
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 07 Feb 2025 13:42:03 +0100
parents 7ac8a2537bc9
children c7dc57c44e8b
comparison
equal deleted inserted replaced
232:7ac8a2537bc9 233:5f4c81313be7
74 encoder = base64.a85encode 74 encoder = base64.a85encode
75 pwd = gen_bin(opts.req_length, encoder) 75 pwd = gen_bin(opts.req_length, encoder)
76 else: 76 else:
77 raise NotImplementedError("type not yet implemented: %s" 77 raise NotImplementedError("type not yet implemented: %s"
78 % opts.repertoire) 78 % opts.repertoire)
79 assert len(pwd) == opts.req_length
79 print(pwd) 80 print(pwd)
80 81
81 82
82 def gen_web(length, chars): 83 def gen_web(length, chars):
83 mult = 256//len(chars) 84 mult = 256//len(chars)