diff --git a/src/LibHac/HorizonResultException.cs b/src/LibHac/Common/HorizonResultException.cs similarity index 98% rename from src/LibHac/HorizonResultException.cs rename to src/LibHac/Common/HorizonResultException.cs index aa2eded6..099b811a 100644 --- a/src/LibHac/HorizonResultException.cs +++ b/src/LibHac/Common/HorizonResultException.cs @@ -1,6 +1,6 @@ using System; -namespace LibHac; +namespace LibHac.Common; public class HorizonResultException : LibHacException { @@ -65,4 +65,4 @@ public class HorizonResultException : LibHacException return ResultValue.ToStringWithName(); } } -} +} \ No newline at end of file diff --git a/src/LibHac/IProgressReport.cs b/src/LibHac/Common/IProgressReport.cs similarity index 96% rename from src/LibHac/IProgressReport.cs rename to src/LibHac/Common/IProgressReport.cs index 7800ea14..4459f353 100644 --- a/src/LibHac/IProgressReport.cs +++ b/src/LibHac/Common/IProgressReport.cs @@ -1,4 +1,4 @@ -namespace LibHac; +namespace LibHac.Common; public interface IProgressReport { @@ -25,4 +25,4 @@ public interface IProgressReport /// /// The message to output. void LogMessage(string message); -} +} \ No newline at end of file diff --git a/src/LibHac/LibHacException.cs b/src/LibHac/Common/LibHacException.cs similarity index 97% rename from src/LibHac/LibHacException.cs rename to src/LibHac/Common/LibHacException.cs index 3196078f..77dcbcac 100644 --- a/src/LibHac/LibHacException.cs +++ b/src/LibHac/Common/LibHacException.cs @@ -1,6 +1,6 @@ using System; -namespace LibHac; +namespace LibHac.Common; /// /// This is the exception that is thrown when an error occurs @@ -33,4 +33,4 @@ public class LibHacException : Exception : base(message, innerException) { } -} +} \ No newline at end of file diff --git a/src/LibHac/ProgressBar.cs b/src/LibHac/Common/ProgressBar.cs similarity index 99% rename from src/LibHac/ProgressBar.cs rename to src/LibHac/Common/ProgressBar.cs index 7648f3a4..c10e4de2 100644 --- a/src/LibHac/ProgressBar.cs +++ b/src/LibHac/Common/ProgressBar.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using System.Text; using System.Threading; -namespace LibHac; +namespace LibHac.Common; public class ProgressBar : IDisposable, IProgressReport { @@ -170,4 +170,4 @@ public class ProgressBar : IDisposable, IProgressReport UpdateText(string.Empty); } } -} +} \ No newline at end of file diff --git a/src/LibHac/ThrowHelper.cs b/src/LibHac/Common/ThrowHelper.cs similarity index 96% rename from src/LibHac/ThrowHelper.cs rename to src/LibHac/Common/ThrowHelper.cs index b6e4524c..34510b7f 100644 --- a/src/LibHac/ThrowHelper.cs +++ b/src/LibHac/Common/ThrowHelper.cs @@ -1,6 +1,6 @@ using System; -namespace LibHac; +namespace LibHac.Common; internal static class ThrowHelper { @@ -19,4 +19,4 @@ internal static class ThrowHelper { throw new ArgumentOutOfRangeException(); } -} +} \ No newline at end of file diff --git a/src/LibHac/Utilities.cs b/src/LibHac/Common/Utilities.cs similarity index 99% rename from src/LibHac/Utilities.cs rename to src/LibHac/Common/Utilities.cs index 1f3eeb15..47a4f336 100644 --- a/src/LibHac/Utilities.cs +++ b/src/LibHac/Common/Utilities.cs @@ -4,7 +4,7 @@ using System.Numerics; using System.Runtime.InteropServices; using System.Text; -namespace LibHac; +namespace LibHac.Common; public static class Utilities { @@ -299,4 +299,4 @@ public static class Utilities return keyGeneration - 1; } -} +} \ No newline at end of file diff --git a/src/LibHac/Validity.cs b/src/LibHac/Common/Validity.cs similarity index 74% rename from src/LibHac/Validity.cs rename to src/LibHac/Common/Validity.cs index 307aa2f8..3bde0664 100644 --- a/src/LibHac/Validity.cs +++ b/src/LibHac/Common/Validity.cs @@ -1,4 +1,4 @@ -namespace LibHac; +namespace LibHac.Common; public enum Validity : byte { @@ -6,4 +6,4 @@ public enum Validity : byte Invalid, Valid, MissingKey -} +} \ No newline at end of file diff --git a/src/LibHac/Crypto/Impl/AesCbcModeNi.cs b/src/LibHac/Crypto/Impl/AesCbcModeNi.cs index 7c61894e..81983c18 100644 --- a/src/LibHac/Crypto/Impl/AesCbcModeNi.cs +++ b/src/LibHac/Crypto/Impl/AesCbcModeNi.cs @@ -105,4 +105,4 @@ public struct AesCbcModeNi Iv = iv; } -} +} \ No newline at end of file diff --git a/src/LibHac/Crypto/Impl/AesCtrModeNi.cs b/src/LibHac/Crypto/Impl/AesCtrModeNi.cs index 85481969..87f0a0f2 100644 --- a/src/LibHac/Crypto/Impl/AesCtrModeNi.cs +++ b/src/LibHac/Crypto/Impl/AesCtrModeNi.cs @@ -4,6 +4,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; +using LibHac.Common; namespace LibHac.Crypto.Impl; diff --git a/src/LibHac/CryptoOld.cs b/src/LibHac/CryptoOld.cs index 07e61113..69a033b2 100644 --- a/src/LibHac/CryptoOld.cs +++ b/src/LibHac/CryptoOld.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Security.Cryptography; +using LibHac.Common; using LibHac.Crypto; using LibHac.FsSystem; diff --git a/src/LibHac/Diag/Abort.cs b/src/LibHac/Diag/Abort.cs index 17db88e5..47215081 100644 --- a/src/LibHac/Diag/Abort.cs +++ b/src/LibHac/Diag/Abort.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; +using LibHac.Common; namespace LibHac.Diag; @@ -81,4 +82,4 @@ public static class Abort { throw new LibHacException($"Unexpected value passed to switch statement in {caller}"); } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/Aes128CtrTransform.cs b/src/LibHac/FsSystem/Aes128CtrTransform.cs index 807f8df5..6626f999 100644 --- a/src/LibHac/FsSystem/Aes128CtrTransform.cs +++ b/src/LibHac/FsSystem/Aes128CtrTransform.cs @@ -3,6 +3,7 @@ using System.Buffers; using System.Buffers.Binary; using System.Runtime.InteropServices; using System.Security.Cryptography; +using LibHac.Common; using LibHac.Util; namespace LibHac.FsSystem; @@ -71,4 +72,4 @@ public class Aes128CtrTransform bufL[i + 1] = BinaryPrimitives.ReverseEndianness(lo); } } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/Aes128XtsTransform.cs b/src/LibHac/FsSystem/Aes128XtsTransform.cs index a4409ad5..d6957c57 100644 --- a/src/LibHac/FsSystem/Aes128XtsTransform.cs +++ b/src/LibHac/FsSystem/Aes128XtsTransform.cs @@ -28,6 +28,7 @@ using System; using System.Buffers; using System.Runtime.InteropServices; using System.Security.Cryptography; +using LibHac.Common; using LibHac.Util; namespace LibHac.FsSystem; @@ -235,4 +236,4 @@ public class Aes128XtsTransform if (tt > 0) i[0] ^= 0x87; } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/AesXtsFileHeader.cs b/src/LibHac/FsSystem/AesXtsFileHeader.cs index 4fc1dd0c..a1f432f2 100644 --- a/src/LibHac/FsSystem/AesXtsFileHeader.cs +++ b/src/LibHac/FsSystem/AesXtsFileHeader.cs @@ -2,6 +2,7 @@ using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; +using LibHac.Common; using LibHac.Fs; using LibHac.Fs.Fsa; @@ -128,4 +129,4 @@ public class AesXtsFileHeader return data; } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs b/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs index c6eebebc..36e80b29 100644 --- a/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs +++ b/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Security.Cryptography; using System.Text; +using LibHac.Common; using LibHac.Fs; using LibHac.Util; @@ -275,4 +276,4 @@ public class IvfcLevelHeader BlockSizePower = reader.ReadInt32(); Reserved = reader.ReadUInt32(); } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/IntegrityVerificationStorage.cs b/src/LibHac/FsSystem/IntegrityVerificationStorage.cs index 0a2fdfc0..5ee42392 100644 --- a/src/LibHac/FsSystem/IntegrityVerificationStorage.cs +++ b/src/LibHac/FsSystem/IntegrityVerificationStorage.cs @@ -1,6 +1,7 @@ using System; using System.Buffers; using System.IO; +using LibHac.Common; using LibHac.Crypto; using LibHac.Fs; using LibHac.Tools.FsSystem.Save; diff --git a/src/LibHac/MemoryResource.cs b/src/LibHac/MemoryResource.cs index 842731f8..7789d853 100644 --- a/src/LibHac/MemoryResource.cs +++ b/src/LibHac/MemoryResource.cs @@ -1,6 +1,7 @@ using System; using System.Buffers; using System.Runtime.CompilerServices; +using LibHac.Common; using Buffer = LibHac.Mem.Buffer; namespace LibHac; diff --git a/src/LibHac/Npdm/Aci0.cs b/src/LibHac/Npdm/Aci0.cs index 13d49956..f46d150b 100644 --- a/src/LibHac/Npdm/Aci0.cs +++ b/src/LibHac/Npdm/Aci0.cs @@ -1,6 +1,7 @@ // ReSharper disable UnusedVariable using System; using System.IO; +using LibHac.Common; namespace LibHac.Npdm; @@ -60,4 +61,4 @@ public class Aci0 new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize); } } -} +} \ No newline at end of file diff --git a/src/LibHac/Npdm/Acid.cs b/src/LibHac/Npdm/Acid.cs index 4b839467..89d45d4d 100644 --- a/src/LibHac/Npdm/Acid.cs +++ b/src/LibHac/Npdm/Acid.cs @@ -1,6 +1,7 @@ // ReSharper disable UnusedVariable using System; using System.IO; +using LibHac.Common; using LibHac.Common.Keys; namespace LibHac.Npdm; @@ -71,4 +72,4 @@ public class Acid KernelAccess = new KernelAccessControl(stream, offset + kernelAccessControlOffset, kernelAccessControlSize); } -} +} \ No newline at end of file diff --git a/src/LibHac/Npdm/NpdmBinary.cs b/src/LibHac/Npdm/NpdmBinary.cs index 5c8c8c95..9b3d6739 100644 --- a/src/LibHac/Npdm/NpdmBinary.cs +++ b/src/LibHac/Npdm/NpdmBinary.cs @@ -2,6 +2,7 @@ using System; using System.Buffers.Binary; using System.IO; +using LibHac.Common; using LibHac.Common.Keys; namespace LibHac.Npdm; @@ -77,4 +78,4 @@ public class NpdmBinary Aci0 = new Aci0(stream, aci0Offset); AciD = new Acid(stream, acidOffset, keySet); } -} +} \ No newline at end of file diff --git a/src/LibHac/Npdm/ServiceAccessControl.cs b/src/LibHac/Npdm/ServiceAccessControl.cs index 285bda79..d7c65b13 100644 --- a/src/LibHac/Npdm/ServiceAccessControl.cs +++ b/src/LibHac/Npdm/ServiceAccessControl.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using LibHac.Common; namespace LibHac.Npdm; @@ -33,4 +34,4 @@ public class ServiceAccessControl bytesRead += length + 1; } } -} +} \ No newline at end of file diff --git a/src/LibHac/Tools/Es/Ticket.cs b/src/LibHac/Tools/Es/Ticket.cs index 664b4eaa..589cf5b9 100644 --- a/src/LibHac/Tools/Es/Ticket.cs +++ b/src/LibHac/Tools/Es/Ticket.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using LibHac.Common; using LibHac.Common.Keys; using LibHac.Util; diff --git a/src/LibHac/Tools/Fs/XciHeader.cs b/src/LibHac/Tools/Fs/XciHeader.cs index d27b3e1a..8a4244c0 100644 --- a/src/LibHac/Tools/Fs/XciHeader.cs +++ b/src/LibHac/Tools/Fs/XciHeader.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Text; +using LibHac.Common; using LibHac.Common.Keys; using LibHac.Crypto; using LibHac.Fs; diff --git a/src/LibHac/Tools/FsSystem/NcaUtils/NcaExtensions.cs b/src/LibHac/Tools/FsSystem/NcaUtils/NcaExtensions.cs index 42b0ed0e..94bc7ddc 100644 --- a/src/LibHac/Tools/FsSystem/NcaUtils/NcaExtensions.cs +++ b/src/LibHac/Tools/FsSystem/NcaUtils/NcaExtensions.cs @@ -1,6 +1,7 @@ using System; using System.Buffers.Binary; using System.Diagnostics; +using LibHac.Common; using LibHac.Crypto; using LibHac.Fs; using LibHac.Fs.Fsa; diff --git a/src/LibHac/Tools/FsSystem/Save/AllocationTable.cs b/src/LibHac/Tools/FsSystem/Save/AllocationTable.cs index 07f1dcaa..4f9b21d8 100644 --- a/src/LibHac/Tools/FsSystem/Save/AllocationTable.cs +++ b/src/LibHac/Tools/FsSystem/Save/AllocationTable.cs @@ -2,6 +2,7 @@ using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; diff --git a/src/LibHac/Tools/FsSystem/Save/Header.cs b/src/LibHac/Tools/FsSystem/Save/Header.cs index eac1b7f6..91e43630 100644 --- a/src/LibHac/Tools/FsSystem/Save/Header.cs +++ b/src/LibHac/Tools/FsSystem/Save/Header.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using LibHac.Common; using LibHac.Common.Keys; using LibHac.Crypto; using LibHac.Fs; diff --git a/src/LibHac/Tools/FsSystem/Save/JournalStorage.cs b/src/LibHac/Tools/FsSystem/Save/JournalStorage.cs index 1f389e92..f11d039d 100644 --- a/src/LibHac/Tools/FsSystem/Save/JournalStorage.cs +++ b/src/LibHac/Tools/FsSystem/Save/JournalStorage.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.IO; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; diff --git a/src/LibHac/Tools/FsSystem/Save/RemapStorage.cs b/src/LibHac/Tools/FsSystem/Save/RemapStorage.cs index eaad938d..0b6b10d8 100644 --- a/src/LibHac/Tools/FsSystem/Save/RemapStorage.cs +++ b/src/LibHac/Tools/FsSystem/Save/RemapStorage.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; diff --git a/src/LibHac/Tools/Ro/Nro.cs b/src/LibHac/Tools/Ro/Nro.cs index caa097eb..c81f788e 100644 --- a/src/LibHac/Tools/Ro/Nro.cs +++ b/src/LibHac/Tools/Ro/Nro.cs @@ -1,4 +1,5 @@ using System.IO; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; diff --git a/src/LibHac/Tools/Settings/Calibration.cs b/src/LibHac/Tools/Settings/Calibration.cs index 0e57d6a1..aec7749b 100644 --- a/src/LibHac/Tools/Settings/Calibration.cs +++ b/src/LibHac/Tools/Settings/Calibration.cs @@ -1,5 +1,6 @@ using System.IO; using System.Text; +using LibHac.Common; namespace LibHac.Tools.Settings; diff --git a/src/hactoolnet/EnumStrings.cs b/src/hactoolnet/EnumStrings.cs index 59595317..4d70ee0a 100644 --- a/src/hactoolnet/EnumStrings.cs +++ b/src/hactoolnet/EnumStrings.cs @@ -1,4 +1,4 @@ -using LibHac; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; using LibHac.Ncm; diff --git a/src/hactoolnet/Options.cs b/src/hactoolnet/Options.cs index 9754a4db..5fda4ee9 100644 --- a/src/hactoolnet/Options.cs +++ b/src/hactoolnet/Options.cs @@ -1,4 +1,5 @@ using LibHac; +using LibHac.Common; using LibHac.Common.Keys; using LibHac.FsSystem; @@ -101,4 +102,4 @@ internal class Context public KeySet KeySet; public ProgressBar Logger; public HorizonClient Horizon; -} +} \ No newline at end of file diff --git a/src/hactoolnet/Print.cs b/src/hactoolnet/Print.cs index a7fb8b9c..480cbc2f 100644 --- a/src/hactoolnet/Print.cs +++ b/src/hactoolnet/Print.cs @@ -1,7 +1,7 @@ using System; using System.Buffers.Binary; using System.Text; -using LibHac; +using LibHac.Common; using LibHac.FsSystem; using LibHac.Tools.FsSystem.NcaUtils; diff --git a/src/hactoolnet/ProcessBench.cs b/src/hactoolnet/ProcessBench.cs index 4f9d7714..57b284cb 100644 --- a/src/hactoolnet/ProcessBench.cs +++ b/src/hactoolnet/ProcessBench.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; -using LibHac; +using LibHac.Common; using LibHac.Crypto; using LibHac.Crypto.Impl; using LibHac.Fs; @@ -390,134 +390,134 @@ internal static class ProcessBench switch (ctx.Options.BenchType?.ToLower()) { case "aesctr": - { - IStorage decStorage = new MemoryStorage(new byte[Size]); - IStorage encStorage = new Aes128CtrStorage(new MemoryStorage(new byte[Size]), new byte[0x10], new byte[0x10], true); + { + IStorage decStorage = new MemoryStorage(new byte[Size]); + IStorage encStorage = new Aes128CtrStorage(new MemoryStorage(new byte[Size]), new byte[0x10], new byte[0x10], true); - CopyBenchmark(decStorage, encStorage, Iterations, "MemoryStorage Encrypt: ", ctx.Logger); - CopyBenchmark(encStorage, decStorage, Iterations, "MemoryStorage Decrypt: ", ctx.Logger); + CopyBenchmark(decStorage, encStorage, Iterations, "MemoryStorage Encrypt: ", ctx.Logger); + CopyBenchmark(encStorage, decStorage, Iterations, "MemoryStorage Decrypt: ", ctx.Logger); - decStorage = new NullStorage(Size); - encStorage = new Aes128CtrStorage(new NullStorage(Size), new byte[0x10], new byte[0x10], true); + decStorage = new NullStorage(Size); + encStorage = new Aes128CtrStorage(new NullStorage(Size), new byte[0x10], new byte[0x10], true); - CopyBenchmark(decStorage, encStorage, Iterations, "NullStorage Encrypt: ", ctx.Logger); - CopyBenchmark(encStorage, decStorage, Iterations, "NullStorage Decrypt: ", ctx.Logger); + CopyBenchmark(decStorage, encStorage, Iterations, "NullStorage Encrypt: ", ctx.Logger); + CopyBenchmark(encStorage, decStorage, Iterations, "NullStorage Decrypt: ", ctx.Logger); - decStorage = new MemoryStorage(new byte[Size]); - encStorage = new CachedStorage(new Aes128CtrStorage(new MemoryStorage(new byte[Size]), new byte[0x10], new byte[0x10], true), 0x4000, 4, true); + decStorage = new MemoryStorage(new byte[Size]); + encStorage = new CachedStorage(new Aes128CtrStorage(new MemoryStorage(new byte[Size]), new byte[0x10], new byte[0x10], true), 0x4000, 4, true); - CopyBenchmark(decStorage, encStorage, Iterations, "CachedStorage Encrypt: ", ctx.Logger); - CopyBenchmark(encStorage, decStorage, Iterations, "CachedStorage Decrypt: ", ctx.Logger); + CopyBenchmark(decStorage, encStorage, Iterations, "CachedStorage Encrypt: ", ctx.Logger); + CopyBenchmark(encStorage, decStorage, Iterations, "CachedStorage Decrypt: ", ctx.Logger); - break; - } + break; + } case "aesxts": - { - IStorage decStorage = new MemoryStorage(new byte[Size]); - IStorage encStorage = new Aes128XtsStorage(new MemoryStorage(new byte[Size]), new byte[0x20], 81920, true); + { + IStorage decStorage = new MemoryStorage(new byte[Size]); + IStorage encStorage = new Aes128XtsStorage(new MemoryStorage(new byte[Size]), new byte[0x20], 81920, true); - CopyBenchmark(decStorage, encStorage, Iterations, "MemoryStorage Encrypt: ", ctx.Logger); - CopyBenchmark(encStorage, decStorage, Iterations, "MemoryStorage Decrypt: ", ctx.Logger); + CopyBenchmark(decStorage, encStorage, Iterations, "MemoryStorage Encrypt: ", ctx.Logger); + CopyBenchmark(encStorage, decStorage, Iterations, "MemoryStorage Decrypt: ", ctx.Logger); - decStorage = new NullStorage(Size); - encStorage = new Aes128XtsStorage(new NullStorage(Size), new byte[0x20], 81920, true); + decStorage = new NullStorage(Size); + encStorage = new Aes128XtsStorage(new NullStorage(Size), new byte[0x20], 81920, true); - CopyBenchmark(decStorage, encStorage, Iterations, "NullStorage Encrypt: ", ctx.Logger); - CopyBenchmark(encStorage, decStorage, Iterations, "NullStorage Decrypt: ", ctx.Logger); + CopyBenchmark(decStorage, encStorage, Iterations, "NullStorage Encrypt: ", ctx.Logger); + CopyBenchmark(encStorage, decStorage, Iterations, "NullStorage Decrypt: ", ctx.Logger); - decStorage = new MemoryStorage(new byte[Size]); - encStorage = new CachedStorage(new Aes128XtsStorage(new MemoryStorage(new byte[Size]), new byte[0x20], 0x4000, true), 4, true); + decStorage = new MemoryStorage(new byte[Size]); + encStorage = new CachedStorage(new Aes128XtsStorage(new MemoryStorage(new byte[Size]), new byte[0x20], 0x4000, true), 4, true); - CopyBenchmark(decStorage, encStorage, Iterations, "CachedStorage Encrypt: ", ctx.Logger); - CopyBenchmark(encStorage, decStorage, Iterations, "CachedStorage Decrypt: ", ctx.Logger); - break; - } + CopyBenchmark(decStorage, encStorage, Iterations, "CachedStorage Encrypt: ", ctx.Logger); + CopyBenchmark(encStorage, decStorage, Iterations, "CachedStorage Decrypt: ", ctx.Logger); + break; + } case "aesecbnew": - { - Func encryptorNet = () => Aes.CreateEcbEncryptor(new byte[0x10], true); - Func encryptorLh = () => Aes.CreateEcbEncryptor(new byte[0x10]); - CipherTaskSeparate encrypt = (input, output, key1, _, _, crypto) => - Aes.EncryptEcb128(input, output, key1, crypto); + { + Func encryptorNet = () => Aes.CreateEcbEncryptor(new byte[0x10], true); + Func encryptorLh = () => Aes.CreateEcbEncryptor(new byte[0x10]); + CipherTaskSeparate encrypt = (input, output, key1, _, _, crypto) => + Aes.EncryptEcb128(input, output, key1, crypto); - RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, true, "AES-ECB encrypt", ctx.Logger); + RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, true, "AES-ECB encrypt", ctx.Logger); - Func decryptorNet = () => Aes.CreateEcbDecryptor(new byte[0x10], true); - Func decryptorLh = () => Aes.CreateEcbDecryptor(new byte[0x10]); - CipherTaskSeparate decrypt = (input, output, key1, _, _, crypto) => - Aes.DecryptEcb128(input, output, key1, crypto); + Func decryptorNet = () => Aes.CreateEcbDecryptor(new byte[0x10], true); + Func decryptorLh = () => Aes.CreateEcbDecryptor(new byte[0x10]); + CipherTaskSeparate decrypt = (input, output, key1, _, _, crypto) => + Aes.DecryptEcb128(input, output, key1, crypto); - RunCipherBenchmark(decryptorNet, decryptorLh, decrypt, true, "AES-ECB decrypt", ctx.Logger); + RunCipherBenchmark(decryptorNet, decryptorLh, decrypt, true, "AES-ECB decrypt", ctx.Logger); - break; - } + break; + } case "aescbcnew": - { - Func encryptorNet = () => Aes.CreateCbcEncryptor(new byte[0x10], new byte[0x10], true); - Func encryptorLh = () => Aes.CreateCbcEncryptor(new byte[0x10], new byte[0x10]); - CipherTaskSeparate encrypt = (input, output, key1, _, iv, crypto) => - Aes.EncryptCbc128(input, output, key1, iv, crypto); + { + Func encryptorNet = () => Aes.CreateCbcEncryptor(new byte[0x10], new byte[0x10], true); + Func encryptorLh = () => Aes.CreateCbcEncryptor(new byte[0x10], new byte[0x10]); + CipherTaskSeparate encrypt = (input, output, key1, _, iv, crypto) => + Aes.EncryptCbc128(input, output, key1, iv, crypto); - RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, true, "AES-CBC encrypt", ctx.Logger); + RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, true, "AES-CBC encrypt", ctx.Logger); - Func decryptorNet = () => Aes.CreateCbcDecryptor(new byte[0x10], new byte[0x10], true); - Func decryptorLh = () => Aes.CreateCbcDecryptor(new byte[0x10], new byte[0x10]); - CipherTaskSeparate decrypt = (input, output, key1, _, iv, crypto) => - Aes.DecryptCbc128(input, output, key1, iv, crypto); + Func decryptorNet = () => Aes.CreateCbcDecryptor(new byte[0x10], new byte[0x10], true); + Func decryptorLh = () => Aes.CreateCbcDecryptor(new byte[0x10], new byte[0x10]); + CipherTaskSeparate decrypt = (input, output, key1, _, iv, crypto) => + Aes.DecryptCbc128(input, output, key1, iv, crypto); - RunCipherBenchmark(decryptorNet, decryptorLh, decrypt, true, "AES-CBC decrypt", ctx.Logger); + RunCipherBenchmark(decryptorNet, decryptorLh, decrypt, true, "AES-CBC decrypt", ctx.Logger); - break; - } + break; + } case "aesctrnew": - { - Func encryptorNet = () => Aes.CreateCtrEncryptor(new byte[0x10], new byte[0x10], true); - Func encryptorLh = () => Aes.CreateCtrEncryptor(new byte[0x10], new byte[0x10]); - CipherTaskSeparate encrypt = (input, output, key1, _, iv, crypto) => - Aes.EncryptCtr128(input, output, key1, iv, crypto); + { + Func encryptorNet = () => Aes.CreateCtrEncryptor(new byte[0x10], new byte[0x10], true); + Func encryptorLh = () => Aes.CreateCtrEncryptor(new byte[0x10], new byte[0x10]); + CipherTaskSeparate encrypt = (input, output, key1, _, iv, crypto) => + Aes.EncryptCtr128(input, output, key1, iv, crypto); - RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, true, "AES-CTR", ctx.Logger); + RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, true, "AES-CTR", ctx.Logger); - break; - } + break; + } case "aesxtsnew": - { - Func encryptorNet = () => Aes.CreateXtsEncryptor(new byte[0x10], new byte[0x10], new byte[0x10], true); - Func encryptorLh = () => Aes.CreateXtsEncryptor(new byte[0x10], new byte[0x10], new byte[0x10]); - CipherTaskSeparate encrypt = (input, output, key1, key2, iv, crypto) => - Aes.EncryptXts128(input, output, key1, key2, iv, crypto); + { + Func encryptorNet = () => Aes.CreateXtsEncryptor(new byte[0x10], new byte[0x10], new byte[0x10], true); + Func encryptorLh = () => Aes.CreateXtsEncryptor(new byte[0x10], new byte[0x10], new byte[0x10]); + CipherTaskSeparate encrypt = (input, output, key1, key2, iv, crypto) => + Aes.EncryptXts128(input, output, key1, key2, iv, crypto); - RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, false, "AES-XTS encrypt", ctx.Logger); + RunCipherBenchmark(encryptorNet, encryptorLh, encrypt, false, "AES-XTS encrypt", ctx.Logger); - Func decryptorNet = () => Aes.CreateXtsDecryptor(new byte[0x10], new byte[0x10], new byte[0x10], true); - Func decryptorLh = () => Aes.CreateXtsDecryptor(new byte[0x10], new byte[0x10], new byte[0x10]); - CipherTaskSeparate decrypt = (input, output, key1, key2, iv, crypto) => - Aes.DecryptXts128(input, output, key1, key2, iv, crypto); + Func decryptorNet = () => Aes.CreateXtsDecryptor(new byte[0x10], new byte[0x10], new byte[0x10], true); + Func decryptorLh = () => Aes.CreateXtsDecryptor(new byte[0x10], new byte[0x10], new byte[0x10]); + CipherTaskSeparate decrypt = (input, output, key1, key2, iv, crypto) => + Aes.DecryptXts128(input, output, key1, key2, iv, crypto); - RunCipherBenchmark(decryptorNet, decryptorLh, decrypt, false, "AES-XTS decrypt", ctx.Logger); + RunCipherBenchmark(decryptorNet, decryptorLh, decrypt, false, "AES-XTS decrypt", ctx.Logger); - break; - } + break; + } case "crypto": - { - var bench = new MultiBenchmark(); + { + var bench = new MultiBenchmark(); - RegisterAesSequentialBenchmarks(bench); - RegisterAesSingleBlockBenchmarks(bench); - RegisterShaBenchmarks(bench); + RegisterAesSequentialBenchmarks(bench); + RegisterAesSingleBlockBenchmarks(bench); + RegisterShaBenchmarks(bench); - bench.Run(); - break; - } + bench.Run(); + break; + } default: ctx.Logger.LogMessage("Unknown benchmark type."); return; } } -} +} \ No newline at end of file diff --git a/src/hactoolnet/ProcessNax0.cs b/src/hactoolnet/ProcessNax0.cs index dc42a6bd..9b26798b 100644 --- a/src/hactoolnet/ProcessNax0.cs +++ b/src/hactoolnet/ProcessNax0.cs @@ -1,7 +1,6 @@ using System; using System.Linq; using System.Text; -using LibHac; using LibHac.Common; using LibHac.Crypto; using LibHac.Fs; @@ -86,4 +85,4 @@ internal static class ProcessNax0 2 => "Custom storage", _ => "Unknown" }; -} +} \ No newline at end of file diff --git a/src/hactoolnet/ProcessPackage.cs b/src/hactoolnet/ProcessPackage.cs index 96d7177b..e1e79c20 100644 --- a/src/hactoolnet/ProcessPackage.cs +++ b/src/hactoolnet/ProcessPackage.cs @@ -17,7 +17,7 @@ internal static class ProcessPackage { using var file = new SharedRef(new LocalStorage(ctx.Options.InFile, FileAccess.Read)); - var package1 = new LibHac.Boot.Package1(); + var package1 = new Package1(); package1.Initialize(ctx.KeySet, in file).ThrowIfFailure(); ctx.Logger.LogMessage(package1.Print()); @@ -54,7 +54,7 @@ internal static class ProcessPackage } } - private static string Print(this LibHac.Boot.Package1 package1) + private static string Print(this Package1 package1) { int colLen = 36; var sb = new StringBuilder(); @@ -177,4 +177,4 @@ internal static class ProcessPackage return sb.ToString(); } -} +} \ No newline at end of file diff --git a/src/hactoolnet/ProcessSave.cs b/src/hactoolnet/ProcessSave.cs index 7bcf63d4..ac831e74 100644 --- a/src/hactoolnet/ProcessSave.cs +++ b/src/hactoolnet/ProcessSave.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using LibHac; using LibHac.Common; using LibHac.Common.Keys; using LibHac.Fs; diff --git a/src/hactoolnet/ProcessSwitchFs.cs b/src/hactoolnet/ProcessSwitchFs.cs index 474498d3..8aa532bd 100644 --- a/src/hactoolnet/ProcessSwitchFs.cs +++ b/src/hactoolnet/ProcessSwitchFs.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; -using LibHac; +using LibHac.Common; using LibHac.Fs; using LibHac.Fs.Fsa; using LibHac.FsSystem; diff --git a/src/hactoolnet/ProcessXci.cs b/src/hactoolnet/ProcessXci.cs index cb2fd280..d8bc0002 100644 --- a/src/hactoolnet/ProcessXci.cs +++ b/src/hactoolnet/ProcessXci.cs @@ -1,7 +1,7 @@ using System.IO; using System.Linq; using System.Text; -using LibHac; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; using LibHac.Tools.Fs; diff --git a/src/hactoolnet/Program.cs b/src/hactoolnet/Program.cs index a7eb00d0..58a83ca1 100644 --- a/src/hactoolnet/Program.cs +++ b/src/hactoolnet/Program.cs @@ -2,6 +2,7 @@ using System; using System.IO; using System.Text; using LibHac; +using LibHac.Common; using LibHac.Common.Keys; using LibHac.Diag; using LibHac.Fs; @@ -221,7 +222,7 @@ public static class Program var keySet = KeySet.CreateDefaultKeySet(); - var logger = ctx.Options.DisableKeyWarns ? null : ctx.Logger; + IProgressReport logger = ctx.Options.DisableKeyWarns ? null : ctx.Logger; // If the user specifies a key file then only load that file into the mode they specified, // otherwise load both prod.keys and dev.keys. @@ -286,4 +287,4 @@ public static class Program { } -} +} \ No newline at end of file diff --git a/tests/LibHac.Tests/DebugAssertHandler.cs b/tests/LibHac.Tests/DebugAssertHandler.cs index af045e7c..0886d0de 100644 --- a/tests/LibHac.Tests/DebugAssertHandler.cs +++ b/tests/LibHac.Tests/DebugAssertHandler.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using LibHac.Common; namespace LibHac.Tests; @@ -8,4 +9,4 @@ public class DebugAssertHandler : DefaultTraceListener { throw new LibHacException(message + detailMessage); } -} +} \ No newline at end of file diff --git a/tests/LibHac.Tests/FsSystem/BucketTreeBuilderTests.cs b/tests/LibHac.Tests/FsSystem/BucketTreeBuilderTests.cs index f64296fa..d52db63a 100644 --- a/tests/LibHac.Tests/FsSystem/BucketTreeBuilderTests.cs +++ b/tests/LibHac.Tests/FsSystem/BucketTreeBuilderTests.cs @@ -1,4 +1,5 @@ using System.Runtime.CompilerServices; +using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; using LibHac.Tests.Common;