From: Markus Triska Date: Sun, 17 May 2020 20:01:22 +0000 (+0200) Subject: type test for salt in crypto_password_hash/3 X-Git-Tag: v0.8.123~17^2~7 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=3855d7ea022caf02b5daf4a59827862ed16529cd;p=scryer-prolog.git type test for salt in crypto_password_hash/3 --- diff --git a/src/prolog/lib/crypto.pl b/src/prolog/lib/crypto.pl index b93a9cff..be6b6b31 100644 --- a/src/prolog/lib/crypto.pl +++ b/src/prolog/lib/crypto.pl @@ -379,7 +379,7 @@ crypto_password_hash(Password0, Hash, Options) :- Algorithm = 'pbkdf2-sha512', % current default and only option option(algorithm(Algorithm), Options, Algorithm), ( member(salt(SaltBytes), Options) -> - true + must_be_bytes(SaltBytes, crypto_password_hash/2) ; crypto_n_random_bytes(16, SaltBytes) ), '$crypto_password_hash'(Password, SaltBytes, Iterations, HashBytes), @@ -601,8 +601,6 @@ encoding_bytes(utf8, Cs, Bs) :- ; domain_error(encryption_encoding, Cs, crypto) ). -char_code(Char, Code) :- atom_codes(Char, [Code]). - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Modular multiplicative inverse.