0

I have a file mytextfile.txt with the checksum: "81b89b1908e3b3b7fcd7526810c32f14". When I move this file from my PC to my MacBook and check it, I get "e97f28bfff174f9643c088814377ada6". Does someone know why?

        /// <summary>
        /// Making sure our mapfiles are not tampered with by calculating the checksum
        /// Source: https://stackoverflow.com/questions/10520048/calculate-md5-checksum-for-a-file
        /// Source: https://en.wikipedia.org/wiki/MD5
        /// </summary>
        /// <param name="filename"></param>
        public string CheckMD5(string filename)
        {
            // "using": automatically disposes the object after use, 
            //  even if exception is casted
            using (var md5 = MD5.Create())
            {
                using (var stream = File.OpenRead(filename))
                {
                    var hash = md5.ComputeHash(stream);
                    return BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
                }
            }
        }

Also sorry if I'm not using the word hashing and checksum correct, still don't quite understand when to use hash and when to use checksum. Could I say my hash is: "123123"?

0 Answers0