Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating Secure Random Passwords #942

Closed
sstubbs opened this issue Mar 3, 2020 · 3 comments · Fixed by #995
Closed

Generating Secure Random Passwords #942

sstubbs opened this issue Mar 3, 2020 · 3 comments · Fixed by #995

Comments

@sstubbs
Copy link

sstubbs commented Mar 3, 2020

Hi,

Is using the following secure for generating user passwords?

random_string: String = thread_rng().sample_iter(&Alphanumeric).take(30).collect();
@burdges
Copy link
Contributor

burdges commented Mar 3, 2020

If users must ever manually copy or worse remember this, then checkout https://crates.io/search?q=diceware

We rarely encounter birthday bound problems with passwords used by humans, so normally going above 128 bits of entropy harms user experience needlessly. Alphanumeric has 2*26 + 10 = 62 symbols, so 5.95 bits of entropy per symbol. Your code gives 178 bits of entropy. It's fine if you use excessive passwords when only machines use I guess.

@sstubbs
Copy link
Author

sstubbs commented Mar 3, 2020

ok thanks a lot. Some passwords are for people and some are for other software so I will use diceware as you suggest for the ones used by people.

@dhardy
Copy link
Member

dhardy commented Mar 9, 2020

Question answered, so I guess we can close this. But before we do, adding documentation to this effect somewhere (perhaps on the Alphanumeric type, or perhaps just in the book) may be worthwhile. @burdges would you like to make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants