You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Lazy interface method for Scrypt cryptoPwHashScryptSalsa208Sha256 (see link) you hardcode your output hash buffer to have size SCRYPTSALSA208SHA256_BYTES_MAX, or 16. I noticed that if you pass in a longer buffer (32 bytes) using the native interface directly, libsodium doesn't throw an error, and you do get a seemingly deterministic 32 byte result that starts with the same 16 bytes as the result of the lazy method. So I'm curious if this is the right application of SCRYPTSALSA208SHA256_BYTES_MAX, and if so, what sort of trouble might I get in if I use this method with a buffer longer than SCRYPTSALSA208SHA256_BYTES_MAX ?
This is a valid point actually. I took the easy way out and just left it as the minimum bytes i.e made SCRYPTSALSA208SHA256_BYTES_MAX == SCRYPTSALSA208SHA256_PASSWD_MIN. In theory it could be anything up to Constants.SIZE_MAX.
I'm going to change it so that the developer has to supply a size. This makes it non-lazy 😢 but I think in this case it's warranted.
In the Lazy interface method for Scrypt
cryptoPwHashScryptSalsa208Sha256
(see link) you hardcode your output hash buffer to have sizeSCRYPTSALSA208SHA256_BYTES_MAX
, or16
. I noticed that if you pass in a longer buffer (32 bytes) using the native interface directly, libsodium doesn't throw an error, and you do get a seemingly deterministic 32 byte result that starts with the same 16 bytes as the result of the lazy method. So I'm curious if this is the right application ofSCRYPTSALSA208SHA256_BYTES_MAX
, and if so, what sort of trouble might I get in if I use this method with a buffer longer thanSCRYPTSALSA208SHA256_BYTES_MAX
?lazysodium-java/src/main/java/com/goterl/lazycode/lazysodium/LazySodiumJava.java
Line 79 in 6621320
The text was updated successfully, but these errors were encountered: