type test for salt in crypto_password_hash/3

This commit is contained in:
Markus Triska
2020-05-17 22:01:22 +02:00
parent eecd809d9a
commit 3855d7ea02

View File

@@ -379,7 +379,7 @@ crypto_password_hash(Password0, Hash, Options) :-
Algorithm = 'pbkdf2-sha512', % current default and only option Algorithm = 'pbkdf2-sha512', % current default and only option
option(algorithm(Algorithm), Options, Algorithm), option(algorithm(Algorithm), Options, Algorithm),
( member(salt(SaltBytes), Options) -> ( member(salt(SaltBytes), Options) ->
true must_be_bytes(SaltBytes, crypto_password_hash/2)
; crypto_n_random_bytes(16, SaltBytes) ; crypto_n_random_bytes(16, SaltBytes)
), ),
'$crypto_password_hash'(Password, SaltBytes, Iterations, HashBytes), '$crypto_password_hash'(Password, SaltBytes, Iterations, HashBytes),
@@ -601,8 +601,6 @@ encoding_bytes(utf8, Cs, Bs) :-
; domain_error(encryption_encoding, Cs, crypto) ; domain_error(encryption_encoding, Cs, crypto)
). ).
char_code(Char, Code) :- atom_codes(Char, [Code]).
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Modular multiplicative inverse. Modular multiplicative inverse.