Initial checkin.

This commit is contained in:
Jesper Louis Andersen
2014-11-18 23:16:49 +01:00
commit 9a7f4c8d4e
11 changed files with 178 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
console:
erl -pa ../ebin ../deps/*/ebin
clean:
rm *.beam
+33
View File
@@ -0,0 +1,33 @@
-module(enacl_eqc).
-include_lib("eqc/include/eqc.hrl").
-compile(export_all).
%% CRYPTO BOX
%% ---------------------------
prop_box_keypair() ->
?FORALL(_X, return(dummy),
ok_box(enacl:box_keypair())).
ok_box({ok, _PK, _SK}) -> true;
ok_box(_) -> false.
%% HASHING
%% ---------------------------
diff_pair(Sz) ->
?SUCHTHAT({X, Y}, {binary(Sz), binary(Sz)},
X /= Y).
prop_crypto_hash_eq() ->
?FORALL(Sz, oneof([1, 128, 1024, 1024*4]),
?FORALL(X, binary(Sz),
equals(enacl:hash(X), enacl:hash(X))
)).
prop_crypto_hash_neq() ->
?FORALL(Sz, oneof([1, 128, 1024, 1024*4]),
?FORALL({X, Y}, diff_pair(Sz),
enacl:hash(X) /= enacl:hash(Y)
)).