I have a method that reads some files and gets SHA1Managed hashes and then compares it with other hashes from the list, how can I make this method in another thread?
public bool CheckFile(string file, string filehash) { if (File.Exists(file)) { using (FileStream stream = File.OpenRead(file)) { SHA1Managed sha = new SHA1Managed(); byte[] checksum = sha.ComputeHash(stream); string sendCheckSum = BitConverter.ToString(checksum) .Replace("-", string.Empty); return sendCheckSum.ToLower() == filehash; } } else return false; }
source share