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

Generate safe IVs #51086

Merged
merged 1 commit into from Jun 16, 2023
Merged

Commits on Jun 16, 2023

  1. Generate safe IVs

    IVs should never be re-used when using CTR.
    The previous implementation had a 50% probability to generate
    an IV that was already used after 65536 generations.
    This happens because std::mt19937 is seeded using a 32bit integer
    and returns a 32 bits integer.
    Because of the birthday problem, collisions have a 50% chance after
    only 2^16 IV's generations.
    CH uses one IV per file and, for most use cases, 65k files are
    not as many as they seem.
    Also, the initial entropy is gathered using std::random_device
    which is "best-effort" and it's allowed by the standard to
    return a fixed sequence of numbers.
    aiven-sal committed Jun 16, 2023
    Copy the full SHA
    6b49968 View commit details
    Browse the repository at this point in the history