diff --git a/EonaCat.Crypto.sln b/EonaCat.Crypto.sln index 7f98e1b..d8a911a 100644 --- a/EonaCat.Crypto.sln +++ b/EonaCat.Crypto.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 -VisualStudioVersion = 17.14.36212.18 d17.14 +VisualStudioVersion = 17.14.36212.18 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EonaCat.Crypto", "EonaCat.Crypto\EonaCat.Crypto.csproj", "{E08BA387-7F8B-4BCA-81CA-039173FF1DA9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{D4D451EE-157B-4BCD-92B1-617CF709A35F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {E08BA387-7F8B-4BCA-81CA-039173FF1DA9}.Debug|Any CPU.Build.0 = Debug|Any CPU {E08BA387-7F8B-4BCA-81CA-039173FF1DA9}.Release|Any CPU.ActiveCfg = Release|Any CPU {E08BA387-7F8B-4BCA-81CA-039173FF1DA9}.Release|Any CPU.Build.0 = Release|Any CPU + {D4D451EE-157B-4BCD-92B1-617CF709A35F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4D451EE-157B-4BCD-92B1-617CF709A35F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4D451EE-157B-4BCD-92B1-617CF709A35F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4D451EE-157B-4BCD-92B1-617CF709A35F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/EonaCat.Crypto/EonaCat.Crypto.csproj b/EonaCat.Crypto/EonaCat.Crypto.csproj index 2150e37..37d6127 100644 --- a/EonaCat.Crypto/EonaCat.Crypto.csproj +++ b/EonaCat.Crypto/EonaCat.Crypto.csproj @@ -1,10 +1,32 @@  - Exe - net8.0 + Library + net48;net8.0 enable enable + latest + True + EonaCat.Crypto + EonaCat (Jeroen Saey) + EonaCat (Jeroen Saey) + EonaCat Crypto + EonaCat (Jeroen Saey) + https://www.nuget.org/packages/EonaCat.Crypto/ + icon.png + README.md + EonaCat, Crypto, Security, Hashing, Password, Secure, Jeroen, Saey + + + True + \ + + + True + \ + + + diff --git a/EonaCat.Crypto/EonaCatCrypto.cs b/EonaCat.Crypto/EonaCatCrypto.cs index 56dd374..66c2ff0 100644 --- a/EonaCat.Crypto/EonaCatCrypto.cs +++ b/EonaCat.Crypto/EonaCatCrypto.cs @@ -181,7 +181,7 @@ namespace EonaCat.Crypto byte[] input = new byte[previous.Length + info.Length + 1]; Buffer.BlockCopy(previous, 0, input, 0, previous.Length); Buffer.BlockCopy(info, 0, input, previous.Length, info.Length); - input[^1] = (byte)(i + 1); + input[input.Length -1] = (byte)(i + 1); previous = hmacExpand.ComputeHash(input); roundKeys[i] = new byte[_blockSize]; @@ -218,7 +218,7 @@ namespace EonaCat.Crypto using var hmacExpand = new HMACSHA512Custom(prk); byte[] input = new byte[info.Length + 1]; Buffer.BlockCopy(info, 0, input, 0, info.Length); - input[^1] = 1; // Counter byte + input[input.Length - 1] = 1; // Counter byte byte[] okm = hmacExpand.ComputeHash(input); diff --git a/Example/Example.csproj b/Example/Example.csproj new file mode 100644 index 0000000..1448d3e --- /dev/null +++ b/Example/Example.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/EonaCat.Crypto/Program.cs b/Example/Program.cs similarity index 95% rename from EonaCat.Crypto/Program.cs rename to Example/Program.cs index b13bfc0..e0f17c9 100644 --- a/EonaCat.Crypto/Program.cs +++ b/Example/Program.cs @@ -10,7 +10,7 @@ class Program byte[] key = new byte[128]; RandomNumberGeneratorCustom.ComputeHash(key); - var crypto = new EonaCatCrypto("WERKT DIT GEWOON?"); + var crypto = new EonaCatCrypto("WERKT DIT GEWOON?"); //var crypto = new EonaCatCrypto(key); string longLoremIpsum = @" @@ -71,6 +71,8 @@ End of test string. if (!File.Exists(inputFilePath)) { inputFilePath = "EonaCat.Crypto.SampleFile.txt"; + encryptedFilePath = "EonaCat.Crypto.SampleFile.dat"; + decryptedFilePath = "EonaCat.Crypto.SampleFile_decrypted.txt"; // Create a sample file if it doesn't exist File.WriteAllText(inputFilePath, longLoremIpsum); Console.WriteLine($"Sample file created: {inputFilePath}");