From c175fedbdb96d4153276d4aedc079654e92aeedb Mon Sep 17 00:00:00 2001
From: Deterous <138427222+Deterous@users.noreply.github.com>
Date: Tue, 12 Mar 2024 19:42:23 +0900
Subject: [PATCH] Fix bug for small encrypted regions
---
IRDKit/IRDKit.csproj | 2 +-
LibIRD/IRD.cs | 6 +++++-
LibIRD/LibIRD.csproj | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/IRDKit/IRDKit.csproj b/IRDKit/IRDKit.csproj
index ebe88b1..ee9b9c7 100644
--- a/IRDKit/IRDKit.csproj
+++ b/IRDKit/IRDKit.csproj
@@ -11,7 +11,7 @@
latest
true
true
- 0.7.1
+ 0.8.0
Deterous
diff --git a/LibIRD/IRD.cs b/LibIRD/IRD.cs
index 03bb759..0fb523e 100644
--- a/LibIRD/IRD.cs
+++ b/LibIRD/IRD.cs
@@ -1056,6 +1056,10 @@ namespace LibIRD
CountFiles(dirInfo);
}
+ #endregion
+
+ #region Hashing
+
///
/// Calculate hashes for all region and file extents
///
@@ -1201,7 +1205,7 @@ namespace LibIRD
// Don't decrypt last sectors if the encrypted region ends within this buffer
if (RegionEnd[i] < currentSector + bufSectors)
- encCount -= (int)(currentSector + bufSectors - RegionEnd[i] + 1);
+ encCount -= (int)(currentSector + bufSectors - RegionEnd[i] - 1);
// Decrypt encrypted sectors
DecryptSectors(ref buf, (int)currentSector + encOffset, encOffset, encCount);
diff --git a/LibIRD/LibIRD.csproj b/LibIRD/LibIRD.csproj
index dd09c0b..9e575b3 100644
--- a/LibIRD/LibIRD.csproj
+++ b/LibIRD/LibIRD.csproj
@@ -7,7 +7,7 @@
latest
true
true
- 0.7.1
+ 0.8.0
../nupkg