Closed stanhebben closed 1 year ago
It's always been 16 bytes:
#include <stdio.h>
#include <sodium.h>
int main(void)
{
printf("%zu\n", crypto_pwhash_saltbytes());
return 0;
}
$ zig cc a.c -lsodium
$ ./a.out
16
Seems the rust-sodium wrapper I was using defaults to scryptsalsa208sha256 instead of argon. Explicitly using the scryptsalsa208sha256 functions solves the issue (and that uses a salt of 32 bytes).
It seems the pwhash functions here expect a salt length of 16 bytes. However, libsodium (at least version 1.0.18) uses a 32 bytes salt.
Where does this difference come from, and is there a way to fix this discrepancy with the official libsodium version?