libsodium icon indicating copy to clipboard operation
libsodium copied to clipboard

Support for crypto_pwhash

Open khalyomede opened this issue 4 years ago • 2 comments

Great to see libsodium support for V! I am finding a way to securely store user passwords, is there any plan to support crypto_pwhash?

Edit

Currently trying to giving a try to contribute with the few C skill I have 😅

khalyomede avatar May 29 '21 09:05 khalyomede

I just forked the repo and made a prototype to expect this kind of usage:

import libsodium

fn main() {
  password := "foo"
  hashed_password := libsodium.password_hash(password, "salt") or { panic(err) }

  assert password != hashed_password
}

I've took example from the sign.v file to add the crypto_pwhash_str() signature in translated.v, but when I try to run my tests, this is what is displayed:

$ v test .
Creating libsodium_v_run ... done
---- Testing... --------------------------------------------------------------------
 OK    [1/3]  1374.439 ms sign_test.v
 OK    [2/3]  1454.072 ms libsodium_test.v
 FAIL  [3/3]  1509.700 ms pasword_hash_test.v
Terminated by signal 11 (SIGSEGV)

------------------------------------------------------------------------------------
Summary for all V _test.v files: 1 failed, 2 passed, 3 total. Runtime: 1513 ms.

ERROR: 1

Do you guys know how to troubleshoot this "Terminated by signal 11 (SIGSEGV)" error?

Side note

Don't mind the docker\v\Dockerfile, .editorconfig and docker-compose.yml files, i'll clean them up once this branch is working.

khalyomede avatar May 29 '21 10:05 khalyomede

I'll try to see what the problem is tomorrow.

spytheman avatar Jul 14 '21 22:07 spytheman