mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛Fix CRC64 endian problem.
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
// Copyright © 2011-2018 Natalia Portillo
|
// Copyright © 2011-2018 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@@ -89,7 +90,7 @@ namespace DiscImageChef.Checksums
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public byte[] Final()
|
public byte[] Final()
|
||||||
{
|
{
|
||||||
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
return BigEndianBitConverter.GetBytes(hashInt ^= CRC64_SEED);
|
return BigEndianBitConverter.GetBytes(hashInt ^= CRC64_SEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ namespace DiscImageChef.Checksums
|
|||||||
{
|
{
|
||||||
StringBuilder crc64Output = new StringBuilder();
|
StringBuilder crc64Output = new StringBuilder();
|
||||||
|
|
||||||
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^= CRC64_SEED).Length; i++)
|
for(int i = 0; i < BigEndianBitConverter.GetBytes(hashInt ^= CRC64_SEED).Length; i++)
|
||||||
crc64Output.Append(BigEndianBitConverter.GetBytes(hashInt ^= CRC64_SEED)[i].ToString("x2"));
|
crc64Output.Append(BigEndianBitConverter.GetBytes(hashInt ^= CRC64_SEED)[i].ToString("x2"));
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ namespace DiscImageChef.Checksums
|
|||||||
localhashInt = (localhashInt >> 8) ^ localTable[(ulong)fileStream.ReadByte() ^ (localhashInt & 0xffL)];
|
localhashInt = (localhashInt >> 8) ^ localTable[(ulong)fileStream.ReadByte() ^ (localhashInt & 0xffL)];
|
||||||
|
|
||||||
localhashInt ^= CRC64_SEED;
|
localhashInt ^= CRC64_SEED;
|
||||||
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
hash = BigEndianBitConverter.GetBytes(localhashInt);
|
hash = BigEndianBitConverter.GetBytes(localhashInt);
|
||||||
|
|
||||||
StringBuilder crc64Output = new StringBuilder();
|
StringBuilder crc64Output = new StringBuilder();
|
||||||
@@ -196,7 +197,7 @@ namespace DiscImageChef.Checksums
|
|||||||
localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ (localhashInt & 0xff)];
|
localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ (localhashInt & 0xff)];
|
||||||
|
|
||||||
localhashInt ^= CRC64_SEED;
|
localhashInt ^= CRC64_SEED;
|
||||||
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
hash = BigEndianBitConverter.GetBytes(localhashInt);
|
hash = BigEndianBitConverter.GetBytes(localhashInt);
|
||||||
|
|
||||||
StringBuilder crc64Output = new StringBuilder();
|
StringBuilder crc64Output = new StringBuilder();
|
||||||
|
|||||||
@@ -2209,7 +2209,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
}
|
}
|
||||||
|
|
||||||
Crc64Context.Data(data, out byte[] blockCrc);
|
Crc64Context.Data(data, out byte[] blockCrc);
|
||||||
blockCrc = blockCrc.Reverse().ToArray();
|
blockCrc = blockCrc.ToArray();
|
||||||
if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64)
|
if(BitConverter.ToUInt64(blockCrc, 0) != blockHeader.crc64)
|
||||||
{
|
{
|
||||||
DicConsole.DebugWriteLine("DiscImageChef format plugin",
|
DicConsole.DebugWriteLine("DiscImageChef format plugin",
|
||||||
|
|||||||
Reference in New Issue
Block a user