Extend pwhashing with limits

In the EQC tests, we generate limits at random and verify things work.
This commit is contained in:
Jesper Louis Andersen 2020-02-05 13:41:19 +01:00
parent dea9ce62ed
commit 1cb2c3a2a2
2 changed files with 5 additions and 7 deletions

View File

@ -13,10 +13,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- sign
- Implement missing EQC tests
- Generichash
- Multi-part generic hash
- pwhash
- Extend with limit for ops and memory as well.
## [Unreleased]

View File

@ -762,12 +762,14 @@ pwhash_str_verify(PasswdHash, Passwd) ->
end.
prop_pwhash_str_verify() ->
?FORALL({Passwd},
{?FAULT_RATE(1, 40, g_iodata())},
?FORALL({Passwd, OLimit, MLimit},
{?FAULT_RATE(1, 40, g_iodata()),
elements([interactive, moderate, sensitive]),
elements([interactive, moderate, sensitive])},
begin
case v_iodata(Passwd) of
true ->
Ascii = enacl:pwhash_str(Passwd),
Ascii = enacl:pwhash_str(Passwd, OLimit, MLimit),
S = enacl:pwhash_str_verify(Ascii, Passwd),
equals(S, true);
false ->