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

[spec] Consider storing log(N) in scrypt recipient line #10

Closed
str4d opened this issue Oct 9, 2019 · 1 comment
Closed

[spec] Consider storing log(N) in scrypt recipient line #10

str4d opened this issue Oct 9, 2019 · 1 comment

Comments

@str4d
Copy link

str4d commented Oct 9, 2019

The scrypt library I am using in my Rust implementation takes log(N) as a parameter, which requires a bit of additional logic to handle (computing log(N) from N and verifying that N was an exact power of 2).

Per RFC 7914 section 6:

N: CPU/Memory cost parameter, must be larger than 1, a power of 2, and less than 2^(128 * r / 8).

If N must always be a power of 2, then we could simplify the format and implementations by instead storing log(N). This would remove the need for power-of-two checks, and converting log(N) to N for APIs that take N is a trivial bitshift.

@FiloSottile
Copy link
Owner

Yeah this is a good idea. Let's do that.

str4d added a commit to str4d/rage that referenced this issue Oct 9, 2019
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

No branches or pull requests

2 participants