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

Better random #1081

Merged
merged 2 commits into from
Aug 14, 2024
Merged

Better random #1081

merged 2 commits into from
Aug 14, 2024

Conversation

saghul
Copy link
Member

@saghul saghul commented Aug 14, 2024

Sorry, got nerdsnipped and now you have you review this :-P

No need for a home-grown 8 16 char random string.
- Generate actually unique GUIDs
- Use a better random character generator
- Use a better alphabet for join codes which eliminates ambiguity
@@ -1,12 +1,87 @@
/**
* Helper class to generate random values one by one, using an auxiliary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat trick!

/**
* This alphabet removes all potential ambiguous symbols, so it's well suited for a code.
*/
const BASE32 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cuel. Something comes to mind though, users won't know that they can only enter non ambiguous chars, so on the remote side when they enter the code they still might confuse 0 with O, maybe remove O and I as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to stay with the base32 standard. A monospaced font should take care of that...

@saghul saghul merged commit 7f340e0 into master Aug 14, 2024
4 of 5 checks passed
@saghul saghul deleted the better-random branch August 14, 2024 13:23
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 this pull request may close these issues.

2 participants