I have a project where I get the URL of a file (e.g. www.documents.com/docName.txt) and I want to create a hash for this file. How can i do this.
FileStream filestream; SHA256 mySHA256 = SHA256Managed.Create(); filestream = new FileStream(docUrl, FileMode.Open); filestream.Position = 0; byte[] hashValue = mySHA256.ComputeHash(filestream); Label2.Text = BitConverter.ToString(hashValue).Replace("-", String.Empty); filestream.Close();
This is the code I have to create a hash. But, seeing how he uses filestream, he uses files stored on his hard drive (for example, c: /documents/docName.txt). But I need it to work with the URL of the file, not the file on disk.
source share