Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string getMD5(string filename) // File name.
- {
- using (var md5 = MD5.Create())
- {
- using (var stream = File.OpenRead(filename)) // Supports files > 2 GB unlike reading all lines.
- {
- return BitConverter.ToString(md5.ComputeHash(stream)).Replace("-", "").ToLower();
- //Creates a "normal" MD5 string.
- }
- }
- }
- string[] files = Directory.GetFiles(/* Directory goes here*/); // Gets all files in a folder and puts it into an array.
- foreach (string file in files) // loop over each file making file = "C:\Wallpaper\image.png" etc
- {
- string MD5 = getMD5(file); // See the function definition above.
- // more code here to compare it to a history etc
- }
- /*
- There's probably waaaay more efficient ways to do this
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement