/// <summary> /// Creates a content hash for a file, using a given algorithm. /// </summary> /// <param name="Location">File to compute a hash for</param> /// <param name="Algorithm">Algorithm to use to create the hash</param> /// <returns>New content hash instance containing the hash of the file</returns> public static ContentHash Compute(FileReference Location, HashAlgorithm Algorithm) { using (FileStream Stream = FileReference.Open(Location, FileMode.Open, FileAccess.Read, FileShare.Read)) { return(new ContentHash(Algorithm.ComputeHash(Stream))); } }