A lot of works different areas... no plan
This commit is contained in:
parent
087f8ce0e9
commit
1aea1e894a
16 changed files with 1433 additions and 131 deletions
|
|
@ -5,12 +5,35 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|||
using Microsoft.Extensions.Logging;
|
||||
using Core.Telemetry;
|
||||
using Core.Entities.Users;
|
||||
using System.Diagnostics;
|
||||
using Sodium;
|
||||
|
||||
namespace Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class PasswordHasherTests : TestFixture
|
||||
{
|
||||
|
||||
[TestMethod]
|
||||
public void MyTestMethod()
|
||||
{
|
||||
var stopwatch = Stopwatch.StartNew();
|
||||
|
||||
byte[] salt = PasswordHash.ScryptGenerateSalt();
|
||||
|
||||
// 2. Konverter password til byte[]
|
||||
byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes("password123");
|
||||
|
||||
// 3. Kald ScryptHashBinary korrekt
|
||||
byte[] hash = PasswordHash.ScryptHashBinary(
|
||||
password: passwordBytes,
|
||||
salt: salt, // 32-byte array
|
||||
limit: PasswordHash.Strength.Interactive,
|
||||
outputLength: 32
|
||||
);
|
||||
|
||||
stopwatch.Stop();
|
||||
}
|
||||
[TestMethod]
|
||||
public void HashPassword_ShouldCreateValidHashFormat()
|
||||
{
|
||||
|
|
@ -23,7 +46,7 @@ namespace Tests
|
|||
|
||||
// Assert
|
||||
Assert.AreEqual(3, parts.Length);
|
||||
Assert.AreEqual("100000", parts[0]);
|
||||
Assert.AreEqual("600000", parts[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue