diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2026-11-20 09:01:54 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2026-11-20 09:01:54 +0100 |
| commit | cd5dc67cd98553fc10c7efeaaa675abe68730d01 (patch) | |
| tree | 0deb0e051756cb1d7d8a6b70080d7db479f36b43 /ls47.py | |
| parent | 2977d7c2a6c26dfb7e55ba73b079ace3f163d296 (diff) | |
| download | ls47-cd5dc67cd98553fc10c7efeaaa675abe68730d01.tar.gz ls47-cd5dc67cd98553fc10c7efeaaa675abe68730d01.tar.bz2 | |
fix password expansion (lol uppercase)
Diffstat (limited to 'ls47.py')
| -rwxr-xr-x | ls47.py | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -76,15 +76,15 @@ def rotate_down(key, col, n): def derive_key(password): - k = ''.join(reversed(letters)) + k = "".join(reversed(letters)) i = 0 - for c in password + ' ': - ix = k.find(c,i) - if ix<0: + for c in password + "_": + ix = k.find(c, i) + if ix < 0: continue - k = k[:i] + k[ix] + k[i:ix] + k[ix+1:] + k = k[:i] + k[ix] + k[i:ix] + k[ix + 1 :] i += 1 - return ''.join(reversed(k)) + return "".join(reversed(k)) def encrypt(key, plaintext): @@ -196,7 +196,9 @@ if __name__ == "__main__": args = ap.parse_args() if args.password: - key = derive_key(args.password if args.inx else args.password.replace(' ', '_')) + key = derive_key( + (args.password if args.inx else args.password.replace(" ", "_")).upper() + ) elif args.fullkey: key = args.fullkey else: |
