Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/genpwd.py @ 234:c7dc57c44e8b
FIX: For Python3: decode from ASCII before printing them: this removes the binary b'xxx' representation there
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 07 Feb 2025 13:43:14 +0100 |
| parents | 5f4c81313be7 |
| children | 11819361ea39 |
comparison
equal
deleted
inserted
replaced
| 233:5f4c81313be7 | 234:c7dc57c44e8b |
|---|---|
| 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 assert len(pwd) == opts.req_length |
| 80 if not PY2: | |
| 81 pwd = pwd.decode("ascii") | |
| 80 print(pwd) | 82 print(pwd) |
| 81 | 83 |
| 82 | 84 |
| 83 def gen_web(length, chars): | 85 def gen_web(length, chars): |
| 84 mult = 256//len(chars) | 86 mult = 256//len(chars) |
