mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Added CRC16 to checksum command.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2015-04-19 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Options.cs:
|
||||
* Commands/Checksum.cs:
|
||||
Added CRC16 to checksum command.
|
||||
|
||||
2015-04-19 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Options.cs:
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace DiscImageChef.Commands
|
||||
Console.WriteLine("--whole-disc={0}", options.WholeDisc);
|
||||
Console.WriteLine("--input={0}", options.InputFile);
|
||||
Console.WriteLine("--adler32={0}", options.DoAdler32);
|
||||
Console.WriteLine("--crc16={0}", options.DoCRC16);
|
||||
Console.WriteLine("--crc32={0}", options.DoCRC32);
|
||||
Console.WriteLine("--crc64={0}", options.DoCRC64);
|
||||
Console.WriteLine("--md5={0}", options.DoMD5);
|
||||
@@ -83,6 +84,7 @@ namespace DiscImageChef.Commands
|
||||
foreach (Track currentTrack in inputTracks)
|
||||
{
|
||||
Adler32Context adler32ctxTrack = new Adler32Context();
|
||||
CRC16Context crc16ctxTrack = new CRC16Context();
|
||||
CRC32Context crc32ctxTrack = new CRC32Context();
|
||||
CRC64Context crc64ctxTrack = new CRC64Context();
|
||||
MD5Context md5ctxTrack = new MD5Context();
|
||||
@@ -94,6 +96,8 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if (options.DoAdler32)
|
||||
adler32ctxTrack.Init();
|
||||
if (options.DoCRC16)
|
||||
crc16ctxTrack.Init();
|
||||
if (options.DoCRC32)
|
||||
crc32ctxTrack.Init();
|
||||
if (options.DoCRC64)
|
||||
@@ -120,6 +124,8 @@ namespace DiscImageChef.Commands
|
||||
byte[] sector = inputFormat.ReadSector(i, currentTrack.TrackSequence);
|
||||
if (options.DoAdler32)
|
||||
adler32ctxTrack.Update(sector);
|
||||
if (options.DoCRC16)
|
||||
crc16ctxTrack.Update(sector);
|
||||
if (options.DoCRC32)
|
||||
crc32ctxTrack.Update(sector);
|
||||
if (options.DoCRC64)
|
||||
@@ -142,6 +148,8 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if (options.DoAdler32)
|
||||
Console.WriteLine("Track {0}'s Adler-32: 0x{1}", currentTrack.TrackSequence, adler32ctxTrack.End());
|
||||
if (options.DoCRC16)
|
||||
Console.WriteLine("Track {0}'s CRC16: 0x{1}", currentTrack.TrackSequence, crc16ctxTrack.End());
|
||||
if (options.DoCRC32)
|
||||
Console.WriteLine("Track {0}'s CRC32: 0x{1}", currentTrack.TrackSequence, crc32ctxTrack.End());
|
||||
if (options.DoCRC64)
|
||||
@@ -173,6 +181,7 @@ namespace DiscImageChef.Commands
|
||||
if (options.WholeDisc)
|
||||
{
|
||||
Adler32Context adler32ctx = new Adler32Context();
|
||||
CRC16Context crc16ctx = new CRC16Context();
|
||||
CRC32Context crc32ctx = new CRC32Context();
|
||||
CRC64Context crc64ctx = new CRC64Context();
|
||||
MD5Context md5ctx = new MD5Context();
|
||||
@@ -184,6 +193,8 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if (options.DoAdler32)
|
||||
adler32ctx.Init();
|
||||
if (options.DoCRC16)
|
||||
crc16ctx.Init();
|
||||
if (options.DoCRC32)
|
||||
crc32ctx.Init();
|
||||
if (options.DoCRC64)
|
||||
@@ -210,6 +221,8 @@ namespace DiscImageChef.Commands
|
||||
byte[] sector = inputFormat.ReadSector(i);
|
||||
if (options.DoAdler32)
|
||||
adler32ctx.Update(sector);
|
||||
if (options.DoCRC16)
|
||||
crc16ctx.Update(sector);
|
||||
if (options.DoCRC32)
|
||||
crc32ctx.Update(sector);
|
||||
if (options.DoCRC64)
|
||||
@@ -232,6 +245,8 @@ namespace DiscImageChef.Commands
|
||||
|
||||
if (options.DoAdler32)
|
||||
Console.WriteLine("Disk's Adler-32: 0x{0}", adler32ctx.End());
|
||||
if (options.DoCRC16)
|
||||
Console.WriteLine("Disk's CRC16: 0x{0}", crc16ctx.End());
|
||||
if (options.DoCRC32)
|
||||
Console.WriteLine("Disk's CRC32: 0x{0}", crc32ctx.End());
|
||||
if (options.DoCRC64)
|
||||
|
||||
@@ -86,6 +86,10 @@ namespace DiscImageChef
|
||||
HelpText = "Calculates Adler-32.")]
|
||||
public bool DoAdler32 { get; set; }
|
||||
|
||||
[Option("crc16", DefaultValue = true,
|
||||
HelpText = "Calculates CRC16.")]
|
||||
public bool DoCRC16 { get; set; }
|
||||
|
||||
[Option('c', "crc32", DefaultValue = true,
|
||||
HelpText = "Calculates CRC32.")]
|
||||
public bool DoCRC32 { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user