Why not just say either:
string s = File.ReadAllText(pathToFile);
or
byte[] rawData = File.ReadAllBytes(pathToFile);
For MD5, I'd use the later and generate an MD5 of the raw byte data instead of playing with strings.
"This sounds like the easier solution, and I like things to be cleana nd simple, but how would I make the code compare the hash file that I compute with the one from my text file? I have a text file with over 26k hashes that is going to be compares, so my goal is to compare the hash that I compute with the hashes from the text file, do you understand?"
There are a load of different ways to do that, but what I'd probably do is use a Dictionary for starters.
Because there can only be one hash value for any one file, I'd store the data in the file in pairs, separated by a character illegal in file names: '?' for example.
path/to/file?hashValue
path/to/other/file?otherHashValue
Then I'd read the file using File.ReadAllLines - that gives you an array, with each pair in a separate string.
Use Split to "break" the pairs, and add them to a Dictionary<string, string> so that the Key was the path to the file (since this has to be unique) and the MD5 is the Value.
Then when you generate a MD5 for comparision it's pretty trivial:
if (myDictionaryOfFilesAndHashes[pathToFile] == calculatedMD5HashValueAsAString)
{
...
}
Make sense?