fix: autodispose argon2id
This commit is contained in:
parent
aff98c4144
commit
7df83c9877
1 changed files with 6 additions and 8 deletions
|
@ -86,14 +86,12 @@ public class LoginHandler : IPacketHandler<LoginInfoPacket, AuthSession>
|
|||
using var activity = _activitySource.StartActivity();
|
||||
// https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Chea1t_Sheet.html#argon2id
|
||||
// "Use Argon2id with a minimum configuration of 19 MiB of memory, an iteration count of 2, and 1 degree of parallelism."
|
||||
var argon2Id = new Argon2id(Encoding.ASCII.GetBytes(password))
|
||||
{
|
||||
MemorySize = 1024 * 19,
|
||||
Iterations = 2,
|
||||
DegreeOfParallelism = 1,
|
||||
Salt = salt,
|
||||
AssociatedData = userId.ToByteArray()
|
||||
};
|
||||
using var argon2Id = new Argon2id(Encoding.ASCII.GetBytes(password));
|
||||
argon2Id.MemorySize = 1024 * 19;
|
||||
argon2Id.Iterations = 2;
|
||||
argon2Id.DegreeOfParallelism = 1;
|
||||
argon2Id.Salt = salt;
|
||||
argon2Id.AssociatedData = userId.ToByteArray();
|
||||
return await argon2Id.GetBytesAsync(16);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue