write edoc
This commit is contained in:
parent
d9d541dce8
commit
e20d5d08c4
16
src/sha3.erl
16
src/sha3.erl
@ -5,7 +5,10 @@
|
||||
-on_load(init/0).
|
||||
|
||||
-type bitlen() :: 224 | 256 | 384 | 512.
|
||||
|
||||
-type context() :: binary().
|
||||
%% State of hash operation return.
|
||||
|
||||
-type digest() :: <<_:224>> | <<_:256>> | <<_:384>> | <<_:512>>.
|
||||
|
||||
-define(nif_stub, nif_stub_error(?LINE)).
|
||||
@ -23,18 +26,31 @@ init() ->
|
||||
end,
|
||||
erlang:load_nif(filename:join(PrivDir, sha3_nif), 0).
|
||||
|
||||
%% @doc Returns a new context for hash operation.
|
||||
%% Bit length of digest (`BitLen') must be one of 224, 256, 384 and 512.
|
||||
%% @see hash_update/2
|
||||
-spec hash_init(bitlen()) -> context().
|
||||
hash_init(_BitLen) ->
|
||||
?nif_stub.
|
||||
|
||||
%% @doc Updates the digest by `Context' generated with `hash_init/1'
|
||||
%% using the given `Data' and returns a new updated context.
|
||||
%% `Data' can be any length.
|
||||
%% The returned context can e used `hash_update/2' or `hash_final/1'.
|
||||
%% @see hash_final/1
|
||||
-spec hash_update(context(), binary()) -> context().
|
||||
hash_update(_Context, _Binary) ->
|
||||
?nif_stub.
|
||||
|
||||
%% @doc Finalizes the hash operation with `Context' and
|
||||
%% returns a message digest.
|
||||
%% Length of the digest is determined by an argument of `hash_init/1'.
|
||||
-spec hash_final(context()) -> digest().
|
||||
hash_final(_Context) ->
|
||||
?nif_stub.
|
||||
|
||||
%% @doc Computes a message digest from `Binary'.
|
||||
%% Bit length of digest (`BitLen') must be one of 224, 256, 384 and 512.
|
||||
-spec hash(bitlen(), binary()) -> digest().
|
||||
hash(_BitLen, _Binary) ->
|
||||
?nif_stub.
|
||||
|
Loading…
x
Reference in New Issue
Block a user