diff --git a/src/qrcode_demo.erl b/src/qrcode_demo.erl old mode 100644 new mode 100755 index c148fda..03ef1e2 --- a/src/qrcode_demo.erl +++ b/src/qrcode_demo.erl @@ -47,7 +47,7 @@ -define(PERIOD, 30). run() -> - Passcode = crypto:sha(<<"password">>), + Passcode = crypto:hash(sha, <<"password">>), run(<<"demo@mydomain.com">>, Passcode, ?PERIOD). run(Domain, Passcode, Seconds) -> @@ -100,7 +100,7 @@ get_pixels0(<<>>, Acc) -> %% totp() -> - Key = crypto:sha(<<"password">>), + Key = crypto:hash(sha, <<"password">>), totp(Key, ?PERIOD). totp(Key, Period) -> T = unow() div Period, @@ -108,7 +108,7 @@ totp(Key, Period) -> %% RFC-4226 "HOTP: An HMAC-Based One-Time Password Algorithm" %% @ref hotp(Key, Count) when is_binary(Key), is_integer(Count) -> - HS = crypto:sha_mac(Key, <>), + HS = crypto:hmac(sha, Key, <>), <<_:19/binary, _:4, Offset:4>> = HS, <<_:Offset/binary, _:1, P:31, _/binary>> = HS, HOTP = integer_to_list(P rem 1000000),