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

Add a technical explanation of the 256 character cap on the alphabet #35

Closed
davidklebanoff opened this issue Oct 21, 2017 · 6 comments
Closed

Comments

@davidklebanoff
Copy link
Contributor

The README says the "alphabet must contain less than 256 symbols.". It would be nice to have a technical explanation of why. Hopefully something more than "It will not be secure." :)

@ai
Copy link
Owner

ai commented Oct 21, 2017

It is just algorithm limits. Symbols on 256, 257, … positions will be ignored.

I change text a little 9796c48

Maybe you can do it better.

@ai
Copy link
Owner

ai commented Oct 21, 2017

If you didn’t want to explain it better, I will release 1.0.

@davidklebanoff
Copy link
Contributor Author

davidklebanoff commented Oct 21, 2017

You'll want to address the language here:

* Alphabet must contain 256 symbols or less. Otherwise, the generator

Which states "Alphabet must contain 256 symbols or less. Otherwise, the generator will not be secure.". It's both wrong because it should be "less than 256 symbols", and also the part about it "not being secure" is confusing.

And possibly add a length check in the function to throw an appropriate error for alphabets greater than 255 characters.

@ai ai closed this as completed Oct 21, 2017
@ai
Copy link
Owner

ai commented Oct 21, 2017

It's both wrong because it should be "less than 256 symbols"

Nope, random byte has values between 0...255 (from 0), so 256 symbols (we start to count from 1) could be matched in this interval.

not being secure

I am open for suggestion :). It is less secure because we use random bytes per symbol, so any >255 symbols will be ignored in ID.

And possibly add a length check in the function to throw an appropriate error for alphabets greater than 255 characters.

Do you know real cases for this? ;)

@davidklebanoff
Copy link
Contributor Author

I was just going off the language you used in the commit you were referencing (9796c48), which stated "Only alphabets with less than 256 symbols are supported." Either format.js is wrong or the README is wrong as they conflict. :)

@ai
Copy link
Owner

ai commented Oct 21, 2017

Ouh, understand :).

I copied text from generate.js to README.md. Is it OK right now?

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

No branches or pull requests

2 participants