redacted / XKCD-password-generator

Generate secure multiword passwords/passphrases, inspired by XKCD
BSD 3-Clause "New" or "Revised" License
1.32k stars 185 forks source link

Extra delimiters when using "-R" option #150

Closed davidshen84 closed 1 year ago

davidshen84 commented 1 year ago

With -d, delimiters are inserted between the words

> xkcdpass -d.
garnet.dallying.eclipse.childcare.comply.slider

re. https://github.com/redacted/XKCD-password-generator/blob/master/xkcdpass/xkcd_password.py#L343C24-L343C24

With -R, delimiters are inserted at the beginning, the end and between the words

> xkcdpass -R
7sturdy#sporting^collector@boned&halogen*undying7

re. https://github.com/redacted/XKCD-password-generator/blob/master/xkcdpass/xkcd_password.py#L366

I wonder if it is implement like so intentionally. I think -R should only insert delimiters between the words.

anakimluke commented 1 year ago

You're right. That's a bit unsettling, isn't it? I think the -R implementation should be changed as you said. Do you want to make a PR? Or do I do it? :)

davidshen84 commented 1 year ago

I think one line would do.

return ''.join(map(lambda w: choose_delimiter(delimiters) + w, words))[:-1]

I have not tested it. I will create a PR tonight if you have not fixed it already.

davidshen84 commented 1 year ago

Do you plan to merge it, or is it not worth the change?

anakimluke commented 1 year ago

I don't have commit rights on this repo ;)

I'll continue the conversation at #151

redacted commented 1 year ago

Closing this as the PR is merged, thank you both!