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 more entropy to the generated secret #1035

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

rosier
Copy link
Contributor

@rosier rosier commented Feb 1, 2025

Increase the "randomness" of the generated secret by extending the used characters from hexadecimal to base58.

I opted for base58 to keep the secret readable.

@rosier rosier changed the base branch from 2.x to 1.x February 1, 2025 17:00
@rosier rosier force-pushed the gen-secret branch 2 times, most recently from 33ce77d to d96ab07 Compare February 9, 2025 16:09
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

👎 on my side:

  • this changes the definition of the $length argument, which was about entropy size and now becomes result's size
  • base58 is not worth the extra logic

return base64_encode(random_bytes($length)) would be just fine if the purpose is having a shorter result. (we could increase the default to 18 bytes to free the base64 string from any trainling =.)

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