Skip to content

Commit

Permalink
imp - brk|doc - Moved MD5 to its own addon
Browse files Browse the repository at this point in the history
---

We've moved the MD5 algorithm from built-in to its own addon.

---

Type: imp
Breaking: True
Doc Required: True
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 8, 2024
1 parent e016180 commit eace255
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Nitrocid.sln
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nitrocid.Legacy.HddUncleane
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Nitrocid.LocaleTrim", "private\Nitrocid.LocaleTrim\Nitrocid.LocaleTrim.csproj", "{6524403F-F55E-4E8D-8A63-8A7D2FA518D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nitrocid.Extras.Md5", "public\Nitrocid.Addons\Nitrocid.Extras.Md5\Nitrocid.Extras.Md5.csproj", "{CE5F80A9-B27E-4D16-AEBB-A09677E63012}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -354,6 +356,10 @@ Global
{6524403F-F55E-4E8D-8A63-8A7D2FA518D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6524403F-F55E-4E8D-8A63-8A7D2FA518D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6524403F-F55E-4E8D-8A63-8A7D2FA518D3}.Release|Any CPU.Build.0 = Release|Any CPU
{CE5F80A9-B27E-4D16-AEBB-A09677E63012}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE5F80A9-B27E-4D16-AEBB-A09677E63012}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE5F80A9-B27E-4D16-AEBB-A09677E63012}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE5F80A9-B27E-4D16-AEBB-A09677E63012}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -414,6 +420,7 @@ Global
{4CDBC217-C639-4D93-9F9A-FFD5956C0395} = {B60F276A-FE12-4001-916E-080344ED1FD9}
{54334767-32A7-46E5-AC1F-5D263F0BE159} = {B60F276A-FE12-4001-916E-080344ED1FD9}
{6524403F-F55E-4E8D-8A63-8A7D2FA518D3} = {5427F963-3094-4111-AB05-DAE364A8DF67}
{CE5F80A9-B27E-4D16-AEBB-A09677E63012} = {B60F276A-FE12-4001-916E-080344ED1FD9}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {424D8E7A-CFEB-40AE-A79C-437D603177FD}
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid.Addons/Nitrocid.Extras.Crc32/Crc32Init.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ void IAddon.StartAddon() =>
DriverHandler.RegisterBaseDriver<IEncryptionDriver>(singleton);

void IAddon.StopAddon() =>
DriverHandler.UnregisterBaseDriver<IEncryptionDriver>("CRC32");
DriverHandler.UnregisterBaseDriver<IEncryptionDriver>(singleton.DriverName);
}
}
3 changes: 3 additions & 0 deletions public/Nitrocid.Addons/Nitrocid.Extras.Md5/AddonMetadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"DllPath": "Nitrocid.Extras.Md5.dll"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//

using Nitrocid.Drivers;
using Nitrocid.Drivers.Encryption;
using Nitrocid.Kernel.Debugging;
using System.IO;
using System.Text.RegularExpressions;
using Encryptor = System.Security.Cryptography.MD5;
using FS = Nitrocid.Files.FilesystemTools;
using TextEncoding = System.Text.Encoding;

namespace Nitrocid.Drivers.Encryption.Bases
namespace Nitrocid.Extras.Md5
{
/// <summary>
/// MD5 encryptor
Expand Down
54 changes: 54 additions & 0 deletions public/Nitrocid.Addons/Nitrocid.Extras.Md5/Md5Init.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// Nitrocid KS Copyright (C) 2018-2024 Aptivi
//
// This file is part of Nitrocid KS
//
// Nitrocid KS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Nitrocid KS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY, without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//

using Nitrocid.Drivers;
using Nitrocid.Drivers.Encryption;
using Nitrocid.Kernel.Extensions;
using Nitrocid.Modifications;
using System;
using System.Collections.ObjectModel;
using System.Reflection;

namespace Nitrocid.Extras.Md5
{
internal class Md5Init : IAddon
{
private readonly MD5 singleton = new();

string IAddon.AddonName =>
InterAddonTranslations.GetAddonName(KnownAddons.ExtrasMd5);

ModLoadPriority IAddon.AddonType => ModLoadPriority.Optional;

ReadOnlyDictionary<string, Delegate> IAddon.PubliclyAvailableFunctions => null;

ReadOnlyDictionary<string, PropertyInfo> IAddon.PubliclyAvailableProperties => null;

ReadOnlyDictionary<string, FieldInfo> IAddon.PubliclyAvailableFields => null;

void IAddon.FinalizeAddon()
{ }

void IAddon.StartAddon() =>
DriverHandler.RegisterBaseDriver<IEncryptionDriver>(singleton);

void IAddon.StopAddon() =>
DriverHandler.UnregisterBaseDriver<IEncryptionDriver>(singleton.DriverName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<Project Sdk="Microsoft.NET.Sdk">

<!-- Extras.Md5 addon General Information -->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DefineTrace>true</DefineTrace>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<TargetFramework>net8.0</TargetFramework>
<OutputPath>..\..\Nitrocid\KSBuild\$(TargetFramework)\Addons\Extras.Md5</OutputPath>
<Description>Nitrocid KS Extras - MD5</Description>
<AssemblyTitle>Nitrocid KS Extras - MD5</AssemblyTitle>
<Copyright>Copyright © Aptivi 2018 - 2024</Copyright>
<Company>Aptivi</Company>
<Product>Nitrocid</Product>
<Version>0.1.0</Version>
<Configurations>Debug;Release</Configurations>
<LangVersion>latest</LangVersion>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\aptivi_snk.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<!-- Extras.Md5 addon General Information End -->

<!-- Extras.Md5 addon Platform Information -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
<DefineDebug>true</DefineDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<Optimize>true</Optimize>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Nitrocid\Nitrocid.csproj" Private="false" />
</ItemGroup>
<ItemGroup>
<None Update="AddonMetadata.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<!-- Extras.Md5 addon Platform Information End -->

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
</ItemGroup>
<PropertyGroup>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

</Project>
1 change: 0 additions & 1 deletion public/Nitrocid/Drivers/DriverHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public static class DriverHandler
DriverTypes.Encryption, new()
{
{ "Default", new SHA256() },
{ "MD5", new MD5() },
{ "SHA1", new SHA1() },
{ "SHA256", new SHA256() },
{ "SHA384", new SHA384() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public static class InterAddonTranslations
{ KnownAddons.ExtrasJsonShell, /* Localizable */ "Extras - JSON Shell" },
{ KnownAddons.ExtrasLanguageStudio, /* Localizable */ "Extras - Language Studio" },
{ KnownAddons.ExtrasMailShell, /* Localizable */ "Extras - Mail Shell" },
{ KnownAddons.ExtrasMd5, /* Localizable */ "Extras - MD5" },
{ KnownAddons.ExtrasNameGen, /* Localizable */ "Extras - NameGen" },
{ KnownAddons.ExtrasNotes, /* Localizable */ "Extras - Notes" },
{ KnownAddons.ExtrasRssShell, /* Localizable */ "Extras - RSS Shell" },
Expand Down
4 changes: 4 additions & 0 deletions public/Nitrocid/Kernel/Extensions/KnownAddons.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ public enum KnownAddons
/// </summary>
ExtrasMailShell,
/// <summary>
/// MD5 Extras addon
/// </summary>
ExtrasMd5,
/// <summary>
/// Name Generator Extras addon
/// </summary>
ExtrasNameGen,
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Nitrocid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<NitrocidModAPIVersionMajor>3.0.25</NitrocidModAPIVersionMajor>

<!-- Increment NitrocidModAPIVersionChangeset every time there is a breaking change or an API addition in the N-KS API. -->
<NitrocidModAPIVersionChangeset>412</NitrocidModAPIVersionChangeset>
<NitrocidModAPIVersionChangeset>413</NitrocidModAPIVersionChangeset>

<!-- To be installed to the file version -->
<NitrocidModAPIVersion>$(NitrocidModAPIVersionMajor).$(NitrocidModAPIVersionChangeset)</NitrocidModAPIVersion>
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
[assembly: InternalsVisibleTo("Nitrocid.Extras.Docking, PublicKey=0024000004800000940000000602000000240000525341310004000001000100812e5231186da64504a543d5306da254e9062027fdaee10f569d93ecc1debc91770d1a077b762aea3ced57c09d9f033f9991960429980b625908628c80785a67a3b65bbb410c7623a0d7bbc1a9770b978358941714b5e2a806e5aa8fa58bb505f859be5fc3ebcce5b2c5d4c0820460c9d3e23cf66f3c00de5e0d154fec6a89b3")]
[assembly: InternalsVisibleTo("Nitrocid.Extras.Diagnostics, PublicKey=0024000004800000940000000602000000240000525341310004000001000100812e5231186da64504a543d5306da254e9062027fdaee10f569d93ecc1debc91770d1a077b762aea3ced57c09d9f033f9991960429980b625908628c80785a67a3b65bbb410c7623a0d7bbc1a9770b978358941714b5e2a806e5aa8fa58bb505f859be5fc3ebcce5b2c5d4c0820460c9d3e23cf66f3c00de5e0d154fec6a89b3")]
[assembly: InternalsVisibleTo("Nitrocid.Extras.Crc32, PublicKey=0024000004800000940000000602000000240000525341310004000001000100812e5231186da64504a543d5306da254e9062027fdaee10f569d93ecc1debc91770d1a077b762aea3ced57c09d9f033f9991960429980b625908628c80785a67a3b65bbb410c7623a0d7bbc1a9770b978358941714b5e2a806e5aa8fa58bb505f859be5fc3ebcce5b2c5d4c0820460c9d3e23cf66f3c00de5e0d154fec6a89b3")]
[assembly: InternalsVisibleTo("Nitrocid.Extras.Md5, PublicKey=0024000004800000940000000602000000240000525341310004000001000100812e5231186da64504a543d5306da254e9062027fdaee10f569d93ecc1debc91770d1a077b762aea3ced57c09d9f033f9991960429980b625908628c80785a67a3b65bbb410c7623a0d7bbc1a9770b978358941714b5e2a806e5aa8fa58bb505f859be5fc3ebcce5b2c5d4c0820460c9d3e23cf66f3c00de5e0d154fec6a89b3")]

// Kernel addons (legacy features)
[assembly: InternalsVisibleTo("Nitrocid.Legacy.InxiNet, PublicKey=0024000004800000940000000602000000240000525341310004000001000100812e5231186da64504a543d5306da254e9062027fdaee10f569d93ecc1debc91770d1a077b762aea3ced57c09d9f033f9991960429980b625908628c80785a67a3b65bbb410c7623a0d7bbc1a9770b978358941714b5e2a806e5aa8fa58bb505f859be5fc3ebcce5b2c5d4c0820460c9d3e23cf66f3c00de5e0d154fec6a89b3")]
[assembly: InternalsVisibleTo("Nitrocid.Legacy.HddUncleaner, PublicKey=0024000004800000940000000602000000240000525341310004000001000100812e5231186da64504a543d5306da254e9062027fdaee10f569d93ecc1debc91770d1a077b762aea3ced57c09d9f033f9991960429980b625908628c80785a67a3b65bbb410c7623a0d7bbc1a9770b978358941714b5e2a806e5aa8fa58bb505f859be5fc3ebcce5b2c5d4c0820460c9d3e23cf66f3c00de5e0d154fec6a89b3")]

0 comments on commit eace255

Please sign in to comment.