Skip to content

Base64StringKeyGenerator should not have a minimum length #17012

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

Open
OrangeDog opened this issue Apr 29, 2025 · 1 comment
Open

Base64StringKeyGenerator should not have a minimum length #17012

OrangeDog opened this issue Apr 29, 2025 · 1 comment
Labels
status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement

Comments

@OrangeDog
Copy link
Contributor

Expected Behavior

As with all other StringKeyGenerators and BytesKeyGenerators, developers should be free to choose an output length as small as they wish.

Current Behavior

Throws IllegalArgumentException if keyLength is less than 32.

Context

I want to generate random keys that are reasonably easy for humans to transcribe.
Base64 provides a good balance of usable character set and entropy per character.

However, this forces a minimum of 43 characters (⌈ 32 * 4/3 ⌉), which is unreasonable for human use.

@OrangeDog OrangeDog added status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement labels Apr 29, 2025
@OrangeDog
Copy link
Contributor Author

It may also be a bug that keyLength is not the actual length of the key, but the pre-encoded length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant