From 5369b1d45e45d4d5c50f2082750cba8f2a74ab56 Mon Sep 17 00:00:00 2001
From: Jonatan Nilsson <jonatan@nilsson.is>
Date: Sun, 9 Feb 2025 06:41:18 +0000
Subject: [PATCH] Initial working implementation, version 1.0.0.0

---
 Hashers/Hashers.cs                           | 131 +++++++++++++++++++
 Hashers/Hashers.csproj                       |  70 ++++++++++
 Hashers/Properties/AssemblyInfo.cs           |  36 +++++
 Hashers/packages.config                      |   9 ++
 MsSQL2019_hashers.sln                        |  51 ++++++++
 MsSQL2019_hashers/MsSQL2019_hashers.csproj   |  89 +++++++++++++
 MsSQL2019_hashers/Properties/AssemblyInfo.cs |  36 +++++
 MsSQL2019_hashers/SqlHashers.cs              |  20 +++
 MsSQL2019_hashers/packages.config            |   4 +
 Testing/App.config                           |   6 +
 Testing/Program.cs                           |  43 ++++++
 Testing/Properties/AssemblyInfo.cs           |  36 +++++
 Testing/Testing.csproj                       |  60 +++++++++
 13 files changed, 591 insertions(+)
 create mode 100644 Hashers/Hashers.cs
 create mode 100644 Hashers/Hashers.csproj
 create mode 100644 Hashers/Properties/AssemblyInfo.cs
 create mode 100644 Hashers/packages.config
 create mode 100644 MsSQL2019_hashers.sln
 create mode 100644 MsSQL2019_hashers/MsSQL2019_hashers.csproj
 create mode 100644 MsSQL2019_hashers/Properties/AssemblyInfo.cs
 create mode 100644 MsSQL2019_hashers/SqlHashers.cs
 create mode 100644 MsSQL2019_hashers/packages.config
 create mode 100644 Testing/App.config
 create mode 100644 Testing/Program.cs
 create mode 100644 Testing/Properties/AssemblyInfo.cs
 create mode 100644 Testing/Testing.csproj

diff --git a/Hashers/Hashers.cs b/Hashers/Hashers.cs
new file mode 100644
index 0000000..5abd9ba
--- /dev/null
+++ b/Hashers/Hashers.cs
@@ -0,0 +1,131 @@
+using Konscious.Security.Cryptography;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+public class Hashers
+{
+    struct settings
+    {
+        public short parallel;
+        public short memory;
+        public short iterations;
+        public short bc;
+    }
+
+    static settings[] all_versions = new settings[]
+    {
+        new settings { }, // Custom
+        new settings { parallel = 4, memory = 64, iterations = 3, bc = 32 },
+    };
+
+    const int use_version = 2;
+
+    public static string Argon2id_hash(string password)
+    {
+        byte[] raw_salt = new byte[16];
+        using (RandomNumberGenerator rng = RandomNumberGenerator.Create())
+        {
+            rng.GetBytes(raw_salt);
+        }
+        settings complexity = all_versions[use_version - 1];
+
+        byte[] raw_hash = argon2id_hash(password, raw_salt, complexity);
+
+        string base64_hash = Convert.ToBase64String(raw_hash);
+        string base64_salt = Convert.ToBase64String(raw_salt);
+
+        return String.Format("{0}${1}${2}${3}", use_version, FormatComplexity(complexity), base64_salt, base64_hash);
+    }
+
+    public static string Argon2id_hash_custom(string password, short parallel, short memory, short iterations, short bc)
+    {
+        byte[] raw_salt = new byte[16];
+        using (RandomNumberGenerator rng = RandomNumberGenerator.Create())
+        {
+            rng.GetBytes(raw_salt);
+        }
+        settings complexity = new settings { parallel = parallel, memory = memory, iterations = iterations, bc = bc };
+
+        byte[] raw_hash = argon2id_hash(password, raw_salt, complexity);
+
+        string base64_hash = Convert.ToBase64String(raw_hash);
+        string base64_salt = Convert.ToBase64String(raw_salt);
+
+        return String.Format("{0}${1}${2}${3}", 1, FormatComplexity(complexity), base64_salt, base64_hash);
+    }
+
+    public static bool Argon2id_verify(string password, string hash)
+    {
+        string[] split = hash.Split('$');
+        if (split.Length == 0)
+        {
+            throw new Exception("Invalid or unknown Argon2id hash");
+        }
+        short version = Convert.ToInt16(split[0]);
+        if (version != 1 && version != 2)
+        {
+            throw new Exception("Invalid or unknown Argon2id hash version");
+        }
+        // version$settings$salt$hash
+        if (split.Length != 4)
+        {
+            throw new Exception("Invalid or unknown Argon2id hash format");
+        }
+
+        settings s = ParseComplexity(version, split[1]);
+        byte[] raw_salt = Convert.FromBase64String(split[2]);
+
+        byte[] raw_hash = argon2id_hash(password, raw_salt, s);
+        string new_hash = Convert.ToBase64String(raw_hash);
+        Console.WriteLine("{0} == {1}", new_hash, split[3]);
+        return new_hash == split[3];
+    }
+
+    private static byte[] argon2id_hash(string password, byte[] salt, settings complexity)
+    {
+        using (var argon2 = new Argon2id(Encoding.UTF8.GetBytes(password)))
+        {
+            argon2.DegreeOfParallelism = complexity.parallel;
+            argon2.MemorySize = 1024 * complexity.memory;
+            argon2.Iterations = complexity.iterations;
+            argon2.Salt = salt;
+
+            return argon2.GetBytes(complexity.bc);
+        }
+    }
+
+    private static string FormatComplexity(settings complexity)
+    {
+        return String.Format("p={0};m={1};i={2};bc={3}", complexity.parallel, complexity.memory, complexity.iterations, complexity.bc);
+    }
+
+    private static settings ParseComplexity(int version, string raw_complexity)
+    {
+        if (version != 1 && version != 2)
+        {
+            throw new Exception("Invalid or unknown Argon2id hash version in ParseComplexity");
+        }
+        settings s = new settings();
+
+        foreach (string item in raw_complexity.Split(';'))
+        {
+            string[] key_value = item.Split('=');
+            if (key_value.Length != 2) { continue; }
+
+            if (key_value[0] == "p") { s.parallel = Convert.ToInt16(key_value[1]); }
+            if (key_value[0] == "m") { s.memory = Convert.ToInt16(key_value[1]); }
+            if (key_value[0] == "i") { s.iterations = Convert.ToInt16(key_value[1]); }
+            if (key_value[0] == "bc") { s.bc = Convert.ToInt16(key_value[1]); }
+        }
+
+        if (s.parallel == 0 || s.memory == 0 || s.iterations == 0 || s.bc == 0)
+        {
+            throw new Exception("Invalid or missing Argon2id hash settings");
+        }
+        return s;
+    }
+}
diff --git a/Hashers/Hashers.csproj b/Hashers/Hashers.csproj
new file mode 100644
index 0000000..bfaddfb
--- /dev/null
+++ b/Hashers/Hashers.csproj
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{A1140133-2C17-40B3-A250-AFE1B6E8FF66}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>Hashers</RootNamespace>
+    <AssemblyName>Hashers</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Konscious.Security.Cryptography.Argon2, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Konscious.Security.Cryptography.Argon2.1.3.1\lib\net46\Konscious.Security.Cryptography.Argon2.dll</HintPath>
+    </Reference>
+    <Reference Include="Konscious.Security.Cryptography.Blake2, Version=1.1.1.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\Konscious.Security.Cryptography.Blake2.1.1.1\lib\net46\Konscious.Security.Cryptography.Blake2.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Hashers.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file
diff --git a/Hashers/Properties/AssemblyInfo.cs b/Hashers/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..f4fd097
--- /dev/null
+++ b/Hashers/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Hashers")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Hashers")]
+[assembly: AssemblyCopyright("Copyright ©  2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a1140133-2c17-40b3-a250-afe1b6e8ff66")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Hashers/packages.config b/Hashers/packages.config
new file mode 100644
index 0000000..8e7922b
--- /dev/null
+++ b/Hashers/packages.config
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Konscious.Security.Cryptography.Argon2" version="1.3.1" targetFramework="net472" />
+  <package id="Konscious.Security.Cryptography.Blake2" version="1.1.1" targetFramework="net472" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net472" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
+</packages>
\ No newline at end of file
diff --git a/MsSQL2019_hashers.sln b/MsSQL2019_hashers.sln
new file mode 100644
index 0000000..b34387e
--- /dev/null
+++ b/MsSQL2019_hashers.sln
@@ -0,0 +1,51 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34024.191
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsSQL2019_hashers", "MsSQL2019_hashers\MsSQL2019_hashers.csproj", "{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing", "Testing\Testing.csproj", "{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hashers", "Hashers\Hashers.csproj", "{A1140133-2C17-40B3-A250-AFE1B6E8FF66}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|x64 = Debug|x64
+		Release|Any CPU = Release|Any CPU
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Debug|x64.ActiveCfg = Debug|x64
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Debug|x64.Build.0 = Debug|x64
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Release|x64.ActiveCfg = Release|x64
+		{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}.Release|x64.Build.0 = Release|x64
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Debug|x64.Build.0 = Debug|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Release|Any CPU.Build.0 = Release|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Release|x64.ActiveCfg = Release|Any CPU
+		{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}.Release|x64.Build.0 = Release|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Debug|x64.Build.0 = Debug|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Release|x64.ActiveCfg = Release|Any CPU
+		{A1140133-2C17-40B3-A250-AFE1B6E8FF66}.Release|x64.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {00A0D7B9-2F8E-4091-9C9C-1735A39B3761}
+	EndGlobalSection
+EndGlobal
diff --git a/MsSQL2019_hashers/MsSQL2019_hashers.csproj b/MsSQL2019_hashers/MsSQL2019_hashers.csproj
new file mode 100644
index 0000000..797ace1
--- /dev/null
+++ b/MsSQL2019_hashers/MsSQL2019_hashers.csproj
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{2CB989ED-2B55-46ED-B72D-5A18B26C0A48}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>MsSQL2019_hashers</RootNamespace>
+    <AssemblyName>MsSQL2019_hashers</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x64\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+    <OutputPath>bin\x64\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x64</PlatformTarget>
+    <LangVersion>7.3</LangVersion>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="SqlHashers.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Hashers\Hashers.csproj">
+      <Project>{a1140133-2c17-40b3-a250-afe1b6e8ff66}</Project>
+      <Name>Hashers</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>
+REM copy  "C:\Users\Jonatan Nilsson\source\repos\MsSQL2019_hashers\MsSQL2019_hashers\bin\x64\Release\MsSQL2019_hashers.dll" "C:\clr\MsSQL2019_hashers.dll"</PostBuildEvent>
+  </PropertyGroup>
+  <Import Project="..\packages\ILRepack.Lib.MSBuild.Task.2.0.34.2\build\ILRepack.Lib.MSBuild.Task.targets" Condition="Exists('..\packages\ILRepack.Lib.MSBuild.Task.2.0.34.2\build\ILRepack.Lib.MSBuild.Task.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\ILRepack.Lib.MSBuild.Task.2.0.34.2\build\ILRepack.Lib.MSBuild.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\ILRepack.Lib.MSBuild.Task.2.0.34.2\build\ILRepack.Lib.MSBuild.Task.targets'))" />
+  </Target>
+</Project>
\ No newline at end of file
diff --git a/MsSQL2019_hashers/Properties/AssemblyInfo.cs b/MsSQL2019_hashers/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..eda4507
--- /dev/null
+++ b/MsSQL2019_hashers/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("MsSQL2019_hashers")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("MsSQL2019_hashers")]
+[assembly: AssemblyCopyright("Copyright ©  2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("2cb989ed-2b55-46ed-b72d-5a18b26c0a48")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/MsSQL2019_hashers/SqlHashers.cs b/MsSQL2019_hashers/SqlHashers.cs
new file mode 100644
index 0000000..0c7456c
--- /dev/null
+++ b/MsSQL2019_hashers/SqlHashers.cs
@@ -0,0 +1,20 @@
+public class SqlHashers
+{
+    [Microsoft.SqlServer.Server.SqlProcedure]
+    public static void Argon2id_hash(string password, out string output)
+    {
+        output = Hashers.Argon2id_hash(password);
+    }
+
+    [Microsoft.SqlServer.Server.SqlProcedure]
+    public static void Argon2id_hash_custom(string password, short parallel, short memory, short iterations, short bc, out string output)
+    {
+        output = Hashers.Argon2id_hash_custom(password, parallel, memory, iterations, bc);
+    }
+
+    [Microsoft.SqlServer.Server.SqlProcedure]
+    public static int Argon2id_verify(string password, string hash)
+    {
+        return Hashers.Argon2id_verify(password, hash) ? 1 : 0;
+    }
+}
diff --git a/MsSQL2019_hashers/packages.config b/MsSQL2019_hashers/packages.config
new file mode 100644
index 0000000..87ab5d1
--- /dev/null
+++ b/MsSQL2019_hashers/packages.config
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="ILRepack.Lib.MSBuild.Task" version="2.0.34.2" targetFramework="net472" developmentDependency="true" />
+</packages>
\ No newline at end of file
diff --git a/Testing/App.config b/Testing/App.config
new file mode 100644
index 0000000..56efbc7
--- /dev/null
+++ b/Testing/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+    </startup>
+</configuration>
\ No newline at end of file
diff --git a/Testing/Program.cs b/Testing/Program.cs
new file mode 100644
index 0000000..4cef28f
--- /dev/null
+++ b/Testing/Program.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Diagnostics;
+
+internal class Program
+{
+    static void Main(string[] args)
+    {
+        Stopwatch sw = new Stopwatch();
+        sw.Start();
+        string hashed = Hashers.Argon2id_hash("Hello");
+        sw.Stop();
+        Console.WriteLine("Elapsed={0}", sw.Elapsed);
+        Console.WriteLine(hashed);
+        Console.ReadKey();
+
+        sw = new Stopwatch();
+        sw.Start();
+        bool verified = Hashers.Argon2id_verify("Hello", hashed);
+        sw.Stop();
+
+        Console.WriteLine("Elapsed={0}", sw.Elapsed);
+        Console.WriteLine(verified);
+        Console.ReadKey();
+
+
+        sw = new Stopwatch();
+        sw.Start();
+        hashed = Hashers.Argon2id_hash_custom("Hello", 2, 20, 1, 32);
+        sw.Stop();
+        Console.WriteLine("Elapsed={0}", sw.Elapsed);
+        Console.WriteLine(hashed);
+        Console.ReadKey();
+
+        sw = new Stopwatch();
+        sw.Start();
+        verified = Hashers.Argon2id_verify("Hello", hashed);
+        sw.Stop();
+
+        Console.WriteLine("Elapsed={0}", sw.Elapsed);
+        Console.WriteLine(verified);
+        Console.ReadKey();
+    }
+}
diff --git a/Testing/Properties/AssemblyInfo.cs b/Testing/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..5a82ea0
--- /dev/null
+++ b/Testing/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Testing")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Testing")]
+[assembly: AssemblyCopyright("Copyright ©  2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("fd25ebd8-4208-4b65-889d-637a5eea1dd7")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Testing/Testing.csproj b/Testing/Testing.csproj
new file mode 100644
index 0000000..9efc613
--- /dev/null
+++ b/Testing/Testing.csproj
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{FD25EBD8-4208-4B65-889D-637A5EEA1DD7}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>Testing</RootNamespace>
+    <AssemblyName>Testing</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\Hashers\Hashers.csproj">
+      <Project>{a1140133-2c17-40b3-a250-afe1b6e8ff66}</Project>
+      <Name>Hashers</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file