From 026e2c1d85a40b5cf70559426225ee586f89744b Mon Sep 17 00:00:00 2001
From: Deterous <138427222+Deterous@users.noreply.github.com>
Date: Fri, 27 Oct 2023 17:47:33 +1300
Subject: [PATCH] Add the MD5 hash of null as a constant
---
BuildIRD/BuildIRD.cs | 1 +
LibIRD/IRD.cs | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/BuildIRD/BuildIRD.cs b/BuildIRD/BuildIRD.cs
index 665cf2f..0693e8f 100644
--- a/BuildIRD/BuildIRD.cs
+++ b/BuildIRD/BuildIRD.cs
@@ -11,6 +11,7 @@ namespace BuildIRD
byte[] discID = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
byte[] discPIC = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
IRD ird = new IRD("Z:", discKey, discID, discPIC);
+ ird.Write("./ ird.ird");
Console.WriteLine(ird.HeaderLength);
}
}
diff --git a/LibIRD/IRD.cs b/LibIRD/IRD.cs
index ec14039..54fbb8f 100644
--- a/LibIRD/IRD.cs
+++ b/LibIRD/IRD.cs
@@ -20,6 +20,11 @@ namespace LibIRD
///
public static readonly byte[] Magic = new byte[] { 0x33, 0x49, 0x52, 0x44 };
+ ///
+ /// MD5 hash of null
+ ///
+ public static readonly byte[] NullMD5 = new byte[] {0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e};
+
///
/// AES encryption/decryption keys and initial values
///
@@ -382,8 +387,6 @@ namespace LibIRD
{
// Keep track of the little-endian 32-bit "IEEE 802.3" CRC value
Crc32 crcStream = new Crc32();
- // TODO: Run as an async Task?
- crcStream.Append(outStream);
// Write IRD data to stream in order
using (BinaryWriter bw = new BinaryWriter(outStream))