adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.25k stars 479 forks source link

Help with crc property #14

Closed cesarpeixoto closed 10 years ago

cesarpeixoto commented 10 years ago

Sorry about my english

I'm trying to get the CRC32 of a file ownership. However, the return shows a wrong result. here's the code

Stream stream = File.OpenRead(@"C:\Test.rar"); var reader = ReaderFactory.Open(stream); while(reader.MoveToNextEntry()) { Label1.Content = reader.Entry.Crc.ToString();
}

The RAR file has only one file inside to test. This code prints this value on label 4263732290 as if CRC

In Winrar, the value pointed to as CRC is FE236442, which is the same value I get when I calculate the uncompressed file.

then used the SevenZipSharp with the following code

SevenZipCompressor.SetLibraryPath(@"C:\7z.dll"); SevenZipExtractor zip = new SevenZipExtractor("Test.rar"); Label1.Content = zip.ArchiveFileData[0].Crc.ToString();

To my death, I got the same result (4263732290). Is there something I'm doing wrong? I need to do another treatment with the warmth of the property to extract the calculation of CRC32??

Another thing I noticed in testing is that the other properties return the correct value (FilePath, CompressedSize, Size) everything works perfectly, minus the CRC32

Thanks for the help

adamhathcock commented 10 years ago

Answer from: https://sharpcompress.codeplex.com/discussions/542362

4263732290 is decimal. FE236442 is hex.