mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
crypto: implement rand.bytes(needed_bytes int) ?[]byte
, use it consistently instead of the old rand.read(), which will change to be compatible with io and the pseudo random rand
module
This commit is contained in:
@ -59,7 +59,7 @@ pub fn compare_hash_and_password(password []byte, hashed_password []byte) ? {
|
||||
|
||||
// generate_salt generate a string to be treated as a salt.
|
||||
pub fn generate_salt() string {
|
||||
randbytes := rand.read(bcrypt.salt_length) or { panic(err) }
|
||||
randbytes := rand.bytes(bcrypt.salt_length) or { panic(err) }
|
||||
return randbytes.bytestr()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user