public void HashByCryptoStream() { var provider = WinRTCrypto.HashAlgorithmProvider.OpenAlgorithm(HashAlgorithm.Sha1); var hasher = provider.CreateHash(); using (var stream = new PCLCrypto.CryptoStream(Stream.Null, hasher, CryptoStreamMode.Write)) { stream.Write(this.data, 0, this.data.Length); } Assert.AreEqual(this.dataHash, Convert.ToBase64String(hasher.GetValueAndReset())); }
public void HashByCryptoStream() { var algorithm = WinRTCrypto.MacAlgorithmProvider.OpenAlgorithm(MacAlgorithm.HmacSha1); var hasher = algorithm.CreateHash(this.keyMaterial); using (var stream = new PCLCrypto.CryptoStream(Stream.Null, hasher, CryptoStreamMode.Write)) { stream.Write(this.data, 0, this.data.Length); } Assert.AreEqual(this.macBase64, Convert.ToBase64String(hasher.GetValueAndReset())); }