Add Blake2s implementation

This commit is contained in:
Hans Svensson
2019-01-28 22:57:32 +01:00
parent 0b1c99cad1
commit af8ac8ba28
2 changed files with 129 additions and 13 deletions
+7
View File
@@ -17,6 +17,13 @@ blake2b_test_() ->
blake2b(_TC = #{in := Msg, key := Key, out := ExpectedOut}) ->
?assertEqual(eblake2:blake2b(byte_size(ExpectedOut), Msg, Key), {ok, ExpectedOut}).
blake2s_test_() ->
{"Tests for BLAKE2s hash implementation",
[ fun() -> blake2s(TC) end || TC <- filter_test_vectors(<<"blake2s">>) ]}.
blake2s(_TC = #{in := Msg, key := Key, out := ExpectedOut}) ->
?assertEqual(eblake2:blake2s(byte_size(ExpectedOut), Msg, Key), {ok, ExpectedOut}).
%% Helper functions
test_vectors() ->
parse_test_vectors("test/blake2_testvectors.json").