Update deprecated crypto:rand_uniform
plus fix missing newline
This commit is contained in:
parent
5c5911e96a
commit
3c94f92fb4
@ -73,7 +73,7 @@ strip_base64( Bin ) ->
|
|||||||
list_to_binary( reverse( dropwhile( F, reverse( binary_to_list( Bin ) ) ) ) ).
|
list_to_binary( reverse( dropwhile( F, reverse( binary_to_list( Bin ) ) ) ) ).
|
||||||
|
|
||||||
random_digits( N ) ->
|
random_digits( N ) ->
|
||||||
list_to_binary( [ nth( crypto:rand_uniform( 1, 10 ), "0123456789" ) || _ <- seq( 1, N ) ] ).
|
list_to_binary( [ nth( rand:uniform( 10 ), "0123456789" ) || _ <- seq( 1, N ) ] ).
|
||||||
|
|
||||||
timestamp() ->
|
timestamp() ->
|
||||||
{ A, B, _ } = os:timestamp(),
|
{ A, B, _ } = os:timestamp(),
|
||||||
|
|||||||
@ -36,7 +36,7 @@ accept(Socket, { Key, Hmac } = Creds) ->
|
|||||||
{ok, Ciphertext} = verify( Bin, Hmac ),
|
{ok, Ciphertext} = verify( Bin, Hmac ),
|
||||||
{ok, Plaintext} = decrypt( Ciphertext, Key ),
|
{ok, Plaintext} = decrypt( Ciphertext, Key ),
|
||||||
{ok, Message} = decode( Plaintext ),
|
{ok, Message} = decode( Plaintext ),
|
||||||
error_logger:info_msg( "Got message: ~p", [ Message ] ),
|
error_logger:info_msg( "Got message: ~p~n", [ Message ] ),
|
||||||
|
|
||||||
accept( Socket, Creds )
|
accept( Socket, Creds )
|
||||||
end.
|
end.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user