No need to use an additional variable just to compose the salted pass.
parent
80af46c6be
commit
ab3ca1ec64
|
@ -70,8 +70,7 @@ is_conflict(Req, State) -> {false, Req, State}.
|
||||||
|
|
||||||
create_user(Req, {Bucket, [{name, Name}, {username, User}, {password, Pass}]}) ->
|
create_user(Req, {Bucket, [{name, Name}, {username, User}, {password, Pass}]}) ->
|
||||||
Salt = rand:bytes(32),
|
Salt = rand:bytes(32),
|
||||||
SaltedPW = <<Pass/binary, Salt/binary>>,
|
Hash = crypto:hash(sha256, <<Pass/binary, Salt/binary>>),
|
||||||
Hash = crypto:hash(sha256, SaltedPW),
|
|
||||||
|
|
||||||
case storage:write(Bucket, User, Hash, [{salt, Salt}, {name, Name}]) of
|
case storage:write(Bucket, User, Hash, [{salt, Salt}, {name, Name}]) of
|
||||||
ok ->
|
ok ->
|
||||||
|
|
Loading…
Reference in New Issue