Use randombytes_uint32

Better name. Says what you are getting.
This commit is contained in:
Jesper Louis Andersen
2020-01-15 14:05:25 +01:00
parent 3c8d54d87b
commit 97ee4bbdcf
4 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -123,7 +123,7 @@
-export([
%% EQC
randombytes/1,
randombytes_int32/0,
randombytes_uint32/0,
randombytes_uniform/1
]).
@@ -1124,11 +1124,11 @@ aead_chacha20poly1305_MESSAGEBYTES_MAX() ->
randombytes(N) ->
enacl_nif:randombytes(N).
%% @doc randombytes_int32/0 produces an integer in the 32bit range
%% @doc randombytes_uint32/0 produces an integer in the 32bit range
%% @end
-spec randombytes_int32() -> integer().
randombytes_int32() ->
enacl_nif:randombytes_int32().
-spec randombytes_uint32() -> integer().
randombytes_uint32() ->
enacl_nif:randombytes_uint32().
%% @doc randombytes_uniform/1 produces a random integer in the space [0..N)
%% That is with the upper bound excluded. Fails for integers above 32bit size
+2 -2
View File
@@ -154,7 +154,7 @@
%% Access to the RNG
-export([
randombytes/1,
randombytes_int32/0,
randombytes_uint32/0,
randombytes_uniform/1
]).
@@ -298,7 +298,7 @@ crypto_kx_PUBLICKEYBYTES() -> erlang:nif_error(nif_not_loaded).
crypto_kx_SECRETKEYBYTES() -> erlang:nif_error(nif_not_loaded).
randombytes(_RequestedSize) -> erlang:nif_error(nif_not_loaded).
randombytes_int32() -> erlang:nif_error(nif_not_loaded).
randombytes_uint32() -> erlang:nif_error(nif_not_loaded).
randombytes_uniform(_UpperBound) -> erlang:nif_error(nif_not_loaded).
scramble_block_16(_Block, _Key) -> erlang:nif_error(nif_not_loaded).