Fix passwd_hash return type error
This commit is contained in:
parent
989d2fd9e7
commit
5d30ceccd1
|
@ -63,12 +63,12 @@ passwd_hash(sha256, Password) ->
|
||||||
passwd_hash(pbkdf2, {Salt, Password, Macfun, Iterations, Dklen}) ->
|
passwd_hash(pbkdf2, {Salt, Password, Macfun, Iterations, Dklen}) ->
|
||||||
case pbkdf2:pbkdf2(Macfun, Password, Salt, Iterations, Dklen) of
|
case pbkdf2:pbkdf2(Macfun, Password, Salt, Iterations, Dklen) of
|
||||||
{ok, Hexstring} -> pbkdf2:to_hex(Hexstring);
|
{ok, Hexstring} -> pbkdf2:to_hex(Hexstring);
|
||||||
{error, Error} -> lager:error("PasswdHash with pbkdf2 error:~p", [Error]), error
|
{error, Error} -> lager:error("PasswdHash with pbkdf2 error:~p", [Error]), <<>>
|
||||||
end;
|
end;
|
||||||
passwd_hash(bcrypt, {Salt, Password}) ->
|
passwd_hash(bcrypt, {Salt, Password}) ->
|
||||||
case bcrypt:hashpw(Password, Salt) of
|
case bcrypt:hashpw(Password, Salt) of
|
||||||
{ok, HashPassword} -> list_to_binary(HashPassword);
|
{ok, HashPassword} -> list_to_binary(HashPassword);
|
||||||
{error, Error}-> lager:error("PasswdHash with bcrypt error:~p", [Error]), error
|
{error, Error}-> lager:error("PasswdHash with bcrypt error:~p", [Error]), <<>>
|
||||||
end.
|
end.
|
||||||
|
|
||||||
hexstring(<<X:128/big-unsigned-integer>>) ->
|
hexstring(<<X:128/big-unsigned-integer>>) ->
|
||||||
|
|
Loading…
Reference in New Issue