mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-07-16 17:47:22 +00:00
Format ./web/backend/Infrastructure/Infrastructure.PasswordHashing
This commit is contained in:
@@ -32,7 +32,7 @@ public class Argon2Infrastructure : IPasswordInfrastructure
|
|||||||
Salt = salt,
|
Salt = salt,
|
||||||
DegreeOfParallelism = Math.Max(Environment.ProcessorCount, 1),
|
DegreeOfParallelism = Math.Max(Environment.ProcessorCount, 1),
|
||||||
MemorySize = ArgonMemoryKb,
|
MemorySize = ArgonMemoryKb,
|
||||||
Iterations = ArgonIterations
|
Iterations = ArgonIterations,
|
||||||
};
|
};
|
||||||
|
|
||||||
byte[] hash = argon2.GetBytes(HashSize);
|
byte[] hash = argon2.GetBytes(HashSize);
|
||||||
@@ -57,10 +57,7 @@ public class Argon2Infrastructure : IPasswordInfrastructure
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] parts = stored.Split(
|
string[] parts = stored.Split(':', StringSplitOptions.RemoveEmptyEntries);
|
||||||
':',
|
|
||||||
StringSplitOptions.RemoveEmptyEntries
|
|
||||||
);
|
|
||||||
if (parts.Length != 2)
|
if (parts.Length != 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -72,7 +69,7 @@ public class Argon2Infrastructure : IPasswordInfrastructure
|
|||||||
Salt = salt,
|
Salt = salt,
|
||||||
DegreeOfParallelism = Math.Max(Environment.ProcessorCount, 1),
|
DegreeOfParallelism = Math.Max(Environment.ProcessorCount, 1),
|
||||||
MemorySize = ArgonMemoryKb,
|
MemorySize = ArgonMemoryKb,
|
||||||
Iterations = ArgonIterations
|
Iterations = ArgonIterations,
|
||||||
};
|
};
|
||||||
|
|
||||||
byte[] actual = argon2.GetBytes(expected.Length);
|
byte[] actual = argon2.GetBytes(expected.Length);
|
||||||
@@ -83,4 +80,4 @@ public class Argon2Infrastructure : IPasswordInfrastructure
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,4 +19,4 @@ public interface IPasswordInfrastructure
|
|||||||
/// <param name="stored">The stored salt/hash string previously produced by <see cref="Hash" />.</param>
|
/// <param name="stored">The stored salt/hash string previously produced by <see cref="Hash" />.</param>
|
||||||
/// <returns><c>true</c> if the password matches the stored hash; otherwise <c>false</c>.</returns>
|
/// <returns><c>true</c> if the password matches the stored hash; otherwise <c>false</c>.</returns>
|
||||||
public bool Verify(string password, string stored);
|
public bool Verify(string password, string stored);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,9 +7,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference
|
<PackageReference Include="Konscious.Security.Cryptography.Argon2" Version="1.3.1" />
|
||||||
Include="Konscious.Security.Cryptography.Argon2"
|
|
||||||
Version="1.3.1"
|
|
||||||
/>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user