dev/core#2370 - Installer - Bump up entropy for autogenerated cred keys #19568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This slightly expands the amount of entropy for certain auto-generated values.
Before
>99%
of generated values have>=232
bitsAfter
>99%
of generated values have>=260
bitsTechnical details
I ran 10,000 iterations with
$toAlphanum(random_bytes(37))
as a source - and checked the size of the resulting keys (each key is a case-senstive alphanumeric, but the lengths vary; each char has 62 possibilities or ~5.95 bits). Distribution:Even in the worst case (42 alphanums, 249 bits), it still significantly exceeded NIST minimum of 112 bits for symmetric crypto keys.
See also: https://lab.civicrm.org/dev/core/-/issues/2370#note_53832