public async Task CheckFileHashAsyncTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); // Act bool matches = await handler.CheckFileHashAsync(filename, fileHash); // Assert Assert.IsTrue(matches); }
public async Task CheckHashFailTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); // Act bool matches = await handler.CheckHashAsync(sample, failHash); // Assert Assert.IsFalse(matches); }
public async Task GetHashAsyncTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); // Act string hash = await handler.GetHashAsync(sample); // Assert Assert.IsTrue(hash.Length > 0); }
public async Task CheckHashFailStreamTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); using var stream = new MemoryStream(Encoding.UTF8.GetBytes(sample)); // Act bool matches = await handler.CheckHashAsync(stream, failHash); // Assert Assert.IsFalse(matches); }
public async Task GetHashAsyncStreamTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); using var stream = new MemoryStream(Encoding.UTF8.GetBytes(sample)); // Act string hash = await handler.GetHashAsync(stream); // Assert Assert.IsTrue(hash.Length > 0); }
public async Task GetAndCheckHashTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); // Act string hash = await handler.GetHashAsync(sample); bool matches = await handler.CheckHashAsync(sample, hash); // Assert Assert.IsTrue(matches); }
public async Task GetAndCheckHashStreamTest() { // Arrange var handler = new ScryptHash(scryptIterations, blockSize, threadCount); 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); }