Removed warnings
This commit is contained in:
parent
cac7de7fca
commit
d6777dd2ec
6
src/qrcode_demo.erl
Normal file → Executable file
6
src/qrcode_demo.erl
Normal file → Executable file
@ -47,7 +47,7 @@
|
|||||||
-define(PERIOD, 30).
|
-define(PERIOD, 30).
|
||||||
|
|
||||||
run() ->
|
run() ->
|
||||||
Passcode = crypto:sha(<<"password">>),
|
Passcode = crypto:hash(sha, <<"password">>),
|
||||||
run(<<"demo@mydomain.com">>, Passcode, ?PERIOD).
|
run(<<"demo@mydomain.com">>, Passcode, ?PERIOD).
|
||||||
|
|
||||||
run(Domain, Passcode, Seconds) ->
|
run(Domain, Passcode, Seconds) ->
|
||||||
@ -100,7 +100,7 @@ get_pixels0(<<>>, Acc) ->
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
totp() ->
|
totp() ->
|
||||||
Key = crypto:sha(<<"password">>),
|
Key = crypto:hash(sha, <<"password">>),
|
||||||
totp(Key, ?PERIOD).
|
totp(Key, ?PERIOD).
|
||||||
totp(Key, Period) ->
|
totp(Key, Period) ->
|
||||||
T = unow() div Period,
|
T = unow() div Period,
|
||||||
@ -108,7 +108,7 @@ totp(Key, Period) ->
|
|||||||
%% RFC-4226 "HOTP: An HMAC-Based One-Time Password Algorithm"
|
%% RFC-4226 "HOTP: An HMAC-Based One-Time Password Algorithm"
|
||||||
%% @ref <http://tools.ietf.org/html/rfc4226>
|
%% @ref <http://tools.ietf.org/html/rfc4226>
|
||||||
hotp(Key, Count) when is_binary(Key), is_integer(Count) ->
|
hotp(Key, Count) when is_binary(Key), is_integer(Count) ->
|
||||||
HS = crypto:sha_mac(Key, <<Count:64>>),
|
HS = crypto:hmac(sha, Key, <<Count:64>>),
|
||||||
<<_:19/binary, _:4, Offset:4>> = HS,
|
<<_:19/binary, _:4, Offset:4>> = HS,
|
||||||
<<_:Offset/binary, _:1, P:31, _/binary>> = HS,
|
<<_:Offset/binary, _:1, P:31, _/binary>> = HS,
|
||||||
HOTP = integer_to_list(P rem 1000000),
|
HOTP = integer_to_list(P rem 1000000),
|
||||||
|
Loading…
Reference in New Issue
Block a user