diff --git a/LibIRD/IRD.cs b/LibIRD/IRD.cs
index 607592e..d674944 100644
--- a/LibIRD/IRD.cs
+++ b/LibIRD/IRD.cs
@@ -168,11 +168,14 @@ namespace LibIRD
/// Generates Data 1, via AES-128 CBC decryption of a Disc Key
///
/// Byte array containing AES encrypted Disc Key
+ ///
///
protected void GenerateD1(byte[] key)
{
// Validate key
- if (key == null || key.Length != 16)
+ if (key == null)
+ throw new ArgumentNullException(nameof(key));
+ if (key.Length != 16)
throw new ArgumentException("Disc Key must be a byte array of length 16", nameof(key));
// TODO: AES decryption
@@ -183,11 +186,14 @@ namespace LibIRD
/// Generates Data 2, via AES-128 CBC encryption of a Disc ID
///
/// Byte array containing AES decrypted Disc ID
+ ///
///
protected void GenerateD2(byte[] id)
{
// Validate id
- if (id == null || id.Length != 16)
+ if (id == null)
+ throw new ArgumentNullException(nameof(id));
+ if (id.Length != 16)
throw new ArgumentException("Disc ID must be a byte array of length 16", nameof(id));
// TODO: AES encryption
diff --git a/LibIRD/ReIRD.cs b/LibIRD/ReIRD.cs
index 4ac0ed3..9a18621 100644
--- a/LibIRD/ReIRD.cs
+++ b/LibIRD/ReIRD.cs
@@ -10,7 +10,7 @@ namespace LibIRD
public enum Region
{
// Null region
- NONE = 0,
+ NONE = 0x00,
// Japan and Asia
Asia = 0x01, // BLAS/BCAS serials
@@ -162,12 +162,16 @@ namespace LibIRD
/// Generates the UID field
///
/// Redump ISO CRC32 hash
+ ///
///
private void GenerateUID(byte[] crc32)
{
// Validate CRC32
- if (crc32 == null || crc32.Length != 8)
+ if (crc32 == null)
+ throw new ArgumentNullException(nameof(crc32));
+ if (crc32.Length != 8)
throw new ArgumentException("CRC32 hash must be an byte array of length 8", nameof(crc32));
+
// Redump ISO CRC32 hash is used as the Unique ID in the IRD
UID = BitConverter.ToUInt32(crc32, 0);
}