1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/crypto/bcrypt/bcrypt_test.v
2021-11-28 12:40:50 +02:00

12 lines
350 B
V

import crypto.bcrypt
fn test_crypto_bcrypt() {
hash := bcrypt.generate_from_password('password'.bytes(), 10) or { panic(err) }
bcrypt.compare_hash_and_password('password'.bytes(), hash.bytes()) or { panic(err) }
bcrypt.compare_hash_and_password('password2'.bytes(), hash.bytes()) or {
assert err == error('mismatched hash and password')
}
}