Why is Scrypt default work factor not a power of 2? #420
Replies: 2 comments
-
The number in the age recipient is the log2 of the work factor, indeed because only powers of two are valid parameters.
Some implementations just take 18 instead of 2^18 so they can save space and avoid checking that the value is a power of two.
Looks like Dart doesn’t, so you’ll have to pass in 2^n where n is the value in the header.
Sent from a small keyboard
… On May 18, 2022, at 23:00, Maido ***@***.***> wrote:
Looks like it is 18 in the reference implementation, but some Scrypt implementations strictly check for it to be a power of 2 and will fail if it isn't so. Like https://github.com/bcgit/pc-dart/blob/master/lib/key_derivators/scrypt.dart#L50 for example.
Just wondering because this is causing issues for me if I'm trying to decrypt something in Dart implementation when it is encrypted with reference implementation.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
FiloSottile
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Looks like it is 18 in the reference implementation, but some Scrypt implementations strictly check for it to be a power of 2 and will fail if it isn't so. Like https://github.com/bcgit/pc-dart/blob/master/lib/key_derivators/scrypt.dart#L50 for example.
Just wondering because this is causing issues for me if I'm trying to decrypt something in Dart implementation when it is encrypted with reference implementation.
Beta Was this translation helpful? Give feedback.
All reactions