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

Use libsodium constants for scrypt params #231

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

jshawl
Copy link
Contributor

@jshawl jshawl commented Feb 10, 2024

This pull request adds two libsodium constants OPSLIMIT_SENSITIVE and MEMLIMIT_SENSITIVE as default values for the opslimit and memlimit parameters to RbNaCl::PasswordHash.scrypt.

Here is an example of these values being used in the wild: https://github.com/jedisct1/minisign/blob/573988d2355172b6e050fa3fdc974abd3e476988/src/minisign.c#L357-L358

Also for the test case, I updated the expected digest so that there wouldn't be two scrypt_digests.

scrypt_memlimit: 5_432_947,
scrypt_digest: "bcc5c2fd785e4781d1201ed43d84925537e2a540d3de55f5812f29e9dd0a4a00" \
"451a5c8ddbb4862c03d45c75bf91b7fb49265feb667ad5c899fdbf2ca19eac67",
scrypt_opslimit: 33_554_432,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

scrypt_digest: "bcc5c2fd785e4781d1201ed43d84925537e2a540d3de55f5812f29e9dd0a4a00" \
"451a5c8ddbb4862c03d45c75bf91b7fb49265feb667ad5c899fdbf2ca19eac67",
scrypt_opslimit: 33_554_432,
scrypt_memlimit: 1_073_741_824,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jshawl jshawl marked this pull request as ready for review February 10, 2024 01:53
@tarcieri
Copy link
Contributor

tarcieri commented Mar 6, 2024

Can you fix the Rubocop failure?

@jshawl
Copy link
Contributor Author

jshawl commented Mar 7, 2024

sure @tarcieri fb62bc3 but let me know if I should squash, thanks!

@tarcieri tarcieri merged commit b97bfaa into RubyCrypto:main Mar 20, 2024
7 checks passed
@jshawl jshawl deleted the use-sodium-constants branch March 20, 2024 18:54
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