mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -58,10 +58,9 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ crc64Poly;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly;
|
||||
else entry = entry >> 1;
|
||||
|
||||
table[i] = entry;
|
||||
}
|
||||
}
|
||||
@@ -73,8 +72,7 @@ namespace DiscImageChef.Checksums
|
||||
/// <param name="len">Length of buffer to hash.</param>
|
||||
public void Update(byte[] data, uint len)
|
||||
{
|
||||
for(int i = 0; i < len; i++)
|
||||
hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff];
|
||||
for(int i = 0; i < len; i++) hashInt = (hashInt >> 8) ^ table[data[i] ^ hashInt & 0xff];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,10 +140,9 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ crc64Poly;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ crc64Poly;
|
||||
else entry = entry >> 1;
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
|
||||
@@ -158,10 +155,7 @@ namespace DiscImageChef.Checksums
|
||||
|
||||
StringBuilder crc64Output = new StringBuilder();
|
||||
|
||||
for(int i = 0; i < hash.Length; i++)
|
||||
{
|
||||
crc64Output.Append(hash[i].ToString("x2"));
|
||||
}
|
||||
for(int i = 0; i < hash.Length; i++) { crc64Output.Append(hash[i].ToString("x2")); }
|
||||
|
||||
fileStream.Close();
|
||||
|
||||
@@ -199,15 +193,13 @@ namespace DiscImageChef.Checksums
|
||||
{
|
||||
ulong entry = (ulong)i;
|
||||
for(int j = 0; j < 8; j++)
|
||||
if((entry & 1) == 1)
|
||||
entry = (entry >> 1) ^ polynomial;
|
||||
else
|
||||
entry = entry >> 1;
|
||||
if((entry & 1) == 1) entry = (entry >> 1) ^ polynomial;
|
||||
else entry = entry >> 1;
|
||||
|
||||
localTable[i] = entry;
|
||||
}
|
||||
|
||||
for(int i = 0; i < len; i++)
|
||||
localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff];
|
||||
for(int i = 0; i < len; i++) localhashInt = (localhashInt >> 8) ^ localTable[data[i] ^ localhashInt & 0xff];
|
||||
|
||||
localhashInt ^= crc64Seed;
|
||||
BigEndianBitConverter.IsLittleEndian = BigEndianBitConverter.IsLittleEndian;
|
||||
@@ -215,10 +207,7 @@ namespace DiscImageChef.Checksums
|
||||
|
||||
StringBuilder crc64Output = new StringBuilder();
|
||||
|
||||
for(int i = 0; i < hash.Length; i++)
|
||||
{
|
||||
crc64Output.Append(hash[i].ToString("x2"));
|
||||
}
|
||||
for(int i = 0; i < hash.Length; i++) { crc64Output.Append(hash[i].ToString("x2")); }
|
||||
|
||||
return crc64Output.ToString();
|
||||
}
|
||||
@@ -233,6 +222,4 @@ namespace DiscImageChef.Checksums
|
||||
return Data(data, (uint)data.Length, out hash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user