string GettingHashSHA1(string filePath) { Byte[] shaHash; using(var shaForStream = new System.Security.Cryptography.SHA256Managed()) using(System.IO.Stream sourceFileStream = System.IO.File.Open(filePath, System.IO.FileMode.Open)) using (System.IO.Stream sourceStream = new System.Security.Cryptography.CryptoStream(sourceFileStream, shaForStream, System.Security.Cryptography.CryptoStreamMode.Read)) { while (sourceStream.ReadByte() != -1); shaHash = shaForStream.Hash; } _hashFile1 = Convert.ToBase64String(shaHash); return _hashFile1; }
public override int ReadByte() { return(_cryptoStream.ReadByte()); }