Add access to siphash-2-4 (no dirty scheduler necessary).
This commit is contained in:
@@ -59,6 +59,10 @@
|
||||
auth/2,
|
||||
auth_verify/3,
|
||||
|
||||
shorthash_key_size/0,
|
||||
shorthash_size/0,
|
||||
shorthash/2,
|
||||
|
||||
onetime_auth_key_size/0,
|
||||
onetime_auth_size/0,
|
||||
onetime_auth/2,
|
||||
@@ -601,6 +605,29 @@ auth_verify(A, M, K) ->
|
||||
enacl_nif:crypto_auth_verify(A, M, K)
|
||||
end.
|
||||
|
||||
%% @doc shorthash_key_size/0 returns the byte-size of the authentication key
|
||||
%% @end
|
||||
-spec shorthash_key_size() -> pos_integer().
|
||||
shorthash_key_size() -> enacl_nif:crypto_shorthash_KEYBYTES().
|
||||
|
||||
%% @doc shorthash_size/0 returns the byte-size of the authenticator
|
||||
%% @end
|
||||
-spec shorthash_size() -> pos_integer().
|
||||
shorthash_size() -> enacl_nif:crypto_shorthash_BYTES().
|
||||
|
||||
%% @doc shorthash/2 produces a short authenticator (MAC) for a message suitable for hashtables and refs
|
||||
%%
|
||||
%% Given a `Msg' and a `Key' produce a MAC/Authenticator for that message. The key can be reused for several such Msg/Authenticator pairs.
|
||||
%% An eavesdropper will not learn anything extra about the message structure.
|
||||
%% @end
|
||||
-spec shorthash(Msg, Key) -> Authenticator
|
||||
when
|
||||
Msg :: iodata(),
|
||||
Key :: binary(),
|
||||
Authenticator :: binary().
|
||||
shorthash(Msg, Key) ->
|
||||
enacl_nif:crypto_shorthash(Msg, Key).
|
||||
|
||||
%% @doc onetime_auth/2 produces a ONE-TIME authenticator for a message
|
||||
%%
|
||||
%% This function works like {@link auth/2} except that the key must not be used again for subsequent messages. That is, the pair
|
||||
|
||||
@@ -68,6 +68,11 @@
|
||||
crypto_auth_verify/3,
|
||||
crypto_auth_verify_b/3,
|
||||
|
||||
crypto_shorthash_BYTES/0,
|
||||
crypto_shorthash_KEYBYTES/0,
|
||||
|
||||
crypto_shorthash/2,
|
||||
|
||||
crypto_onetimeauth_BYTES/0,
|
||||
crypto_onetimeauth_KEYBYTES/0,
|
||||
|
||||
@@ -177,6 +182,10 @@ crypto_auth_b(_Msg, _Key) -> erlang:nif_error(nif_not_loaded).
|
||||
crypto_auth_verify(_Authenticator, _Msg, _Key) -> erlang:nif_error(nif_not_loaded).
|
||||
crypto_auth_verify_b(_Authenticator, _Msg, _Key) -> erlang:nif_error(nif_not_loaded).
|
||||
|
||||
crypto_shorthash_BYTES() -> erlang:nif_error(nif_not_loaded).
|
||||
crypto_shorthash_KEYBYTES() -> erlang:nif_error(nif_not_loaded).
|
||||
crypto_shorthash(_Msg, _Key) -> erlang:nif_error(nif_not_loaded).
|
||||
|
||||
crypto_onetimeauth_BYTES() -> erlang:nif_error(nif_not_loaded).
|
||||
crypto_onetimeauth_KEYBYTES() -> erlang:nif_error(nif_not_loaded).
|
||||
crypto_onetimeauth(_Msg, _Key) -> erlang:nif_error(nif_not_loaded).
|
||||
|
||||
Reference in New Issue
Block a user