Closed Hellboy00000 closed 3 years ago
Please, describe problem more correctly. 83dcefb7 and 2212294583 are the same numbers. What problem do you have?
I don't know how crc32 work, i just see 2 different numbers. How are this 2 "83dcefb7 and 2212294583" crc32 the same?
Yep. You need to learn number notation. 83dcefb7 - is a number in hexadecimal numeral system and 2212294583 - is a number in decimal.
https://en.wikipedia.org/wiki/Numeral_system#Basis_of_counting_system https://en.wikipedia.org/wiki/Decimal https://en.wikipedia.org/wiki/Hexadecimal
This can't be used to this type of crc32 "83dcefb7" (hexadecimal) ?
If no close the issue because i don't have more question.
Thanks
If you create a new .txt and only write number 1, the crc32 is 83dcefb7. But with your code the crc32 is 2212294583
This 2 code return the same number 2212294583 1 var bytes = File.ReadAllBytes(path); var crc32 = Crc32Algorithm.Compute(bytes); 2 var crc = 0u; using (var f = File.OpenRead("somefile")) { var buffer = new byte[65536]; while (true) { var count = f.Read(buffer, 0, buffer.Length); if (count == 0) break; crc = Crc32Algorithm.Append(crc, buffer, 0, count); } } Console.WriteLine(crc);
The code by kgamecarter don't work using (var stream = new FileStream(path, FileMode.Open)) using (var crc = new Crc32Algorithm()) { var crc32bytes = crc.Compute(stream); var crc32 = BitConverter.ToUInt32(crc32bytes, 0); }