sodium-friends / sodium-native

Low level bindings for libsodium
MIT License
297 stars 63 forks source link

Overriding crypto_pwhash_SALTBYTES #141

Closed taobojlen closed 3 years ago

taobojlen commented 3 years ago

I'm trying to calculate the Argon2id hash of a password/salt where the salt is 32 bytes. sodium-native, and I suspect libsodium, fails to do this with the error "salt" must be crypto_pwhash_SALTBYTES bytes long.

In libsodium, this constant is set to 16 bytes: https://github.com/jedisct1/libsodium/blob/ae4add868124a32d4e54da10f9cd99240aecc0aa/src/libsodium/include/sodium/crypto_pwhash_argon2id.h#L37

I haven't been able to find any documentation on changing this constant -- is it something that's possible in sodium-native, or is it compiled in?

emilbayes commented 3 years ago

The salt is fixed size by libsodium. We cannot change that here, so you’d have to open an issue upstream :)