public async Task CheckHashFailTest() { // Arrange var handler = new ArgonHash(degrees, argonIterations, memorySpace, saltLength, hashLength); // Act bool matches = await handler.CheckHashAsync(sample, failHash); // Assert Assert.IsFalse(matches); }
public async Task GetAndCheckHashTest() { // Arrange var handler = new ArgonHash(degrees, argonIterations, memorySpace, saltLength, hashLength); // Act string hash = await handler.GetHashAsync(sample); bool matches = await handler.CheckHashAsync(sample, hash); // Assert Assert.IsTrue(matches); }
public async Task CheckHashFailStreamTest() { // Arrange var handler = new ArgonHash(degrees, argonIterations, memorySpace, saltLength, hashLength); using var stream = new MemoryStream(Encoding.UTF8.GetBytes(sample)); // Act bool matches = await handler.CheckHashAsync(stream, failHash); // Assert Assert.IsFalse(matches); }
public async Task GetAndCheckHashStreamTest() { // Arrange var handler = new ArgonHash(degrees, argonIterations, memorySpace, saltLength, hashLength); using var stream = new MemoryStream(Encoding.UTF8.GetBytes(sample)); // Act string hash = await handler.GetHashAsync(stream); stream.Position = 0; bool matches = await handler.CheckHashAsync(stream, hash); // Assert Assert.IsTrue(matches); }