No need to use an additional variable just to compose the salted pass.

main
absc 2024-07-27 12:38:30 +02:00
parent 80af46c6be
commit ab3ca1ec64
1 changed files with 1 additions and 2 deletions

View File

@ -70,8 +70,7 @@ is_conflict(Req, State) -> {false, Req, State}.
create_user(Req, {Bucket, [{name, Name}, {username, User}, {password, Pass}]}) ->
Salt = rand:bytes(32),
SaltedPW = <<Pass/binary, Salt/binary>>,
Hash = crypto:hash(sha256, SaltedPW),
Hash = crypto:hash(sha256, <<Pass/binary, Salt/binary>>),
case storage:write(Bucket, User, Hash, [{salt, Salt}, {name, Name}]) of
ok ->