EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GenTables_MIX", "GenTables_MIX.vcxproj", "{CB02E071-218F-4714-A623-99DBFC115A22}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GenTables_XOR_V2", "GenTables_XOR_V2.vcxproj", "{83CA38F1-6018-4FD0-B7CC-192BD3F29715}"
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GenTables_SBX", "GenTables_SBX.vcxproj", "{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GenTables_INI", "GenTables_INI.vcxproj", "{0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
{CB02E071-218F-4714-A623-99DBFC115A22}.Release|x64.Build.0 = Release|x64
{CB02E071-218F-4714-A623-99DBFC115A22}.Release|x86.ActiveCfg = Release|Win32
{CB02E071-218F-4714-A623-99DBFC115A22}.Release|x86.Build.0 = Release|Win32
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Debug|x64.ActiveCfg = Debug|x64
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Debug|x64.Build.0 = Debug|x64
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Debug|x86.ActiveCfg = Debug|Win32
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Debug|x86.Build.0 = Debug|Win32
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Release|x64.ActiveCfg = Release|x64
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Release|x64.Build.0 = Release|x64
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Release|x86.ActiveCfg = Release|Win32
- {83CA38F1-6018-4FD0-B7CC-192BD3F29715}.Release|x86.Build.0 = Release|Win32
{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}.Debug|x64.ActiveCfg = Debug|x64
{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}.Debug|x64.Build.0 = Debug|x64
{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}.Debug|x86.ActiveCfg = Debug|Win32
{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}.Release|x64.Build.0 = Release|x64
{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}.Release|x86.ActiveCfg = Release|Win32
{5581ACF6-5C73-4426-8D2D-A6CC3EDBC7D3}.Release|x86.Build.0 = Release|Win32
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Debug|x64.ActiveCfg = Debug|x64
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Debug|x64.Build.0 = Debug|x64
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Debug|x86.ActiveCfg = Debug|Win32
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Debug|x86.Build.0 = Debug|Win32
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Release|x64.ActiveCfg = Release|x64
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Release|x64.Build.0 = Release|x64
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Release|x86.ActiveCfg = Release|Win32
+ {0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\gen_table_ini.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\boxmuller.h" />
+ <ClInclude Include="include\common.h" />
+ <ClInclude Include="include\hd_table.h" />
+ <ClInclude Include="include\msws.h" />
+ <ClInclude Include="include\thread_utils.h" />
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{0397B459-B2CF-4AAE-BBA7-9D2E2A2597B4}</ProjectGuid>
+ <Keyword>Win32Proj</Keyword>
+ <RootNamespace>GenTables_XOR</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141_xp</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v141_xp</PlatformToolset>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v141_xp</PlatformToolset>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="Shared">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <LinkIncremental>true</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <LinkIncremental>false</LinkIncremental>
+ <OutDir>$(SolutionDir)\bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(SolutionDir)\obj\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;PTW32_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\include</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\lib\$(Platform)\shared;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>pthreadVC2.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_DEBUG;_CONSOLE;PTW32_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\include</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\lib\$(Platform)\shared;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>pthreadVC2.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;PTW32_STATIC_LIB;%(PreprocessorDefinitions);</PreprocessorDefinitions>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\include</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <ControlFlowGuard>false</ControlFlowGuard>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <CreateHotpatchableImage>false</CreateHotpatchableImage>
+ <WholeProgramOptimization>false</WholeProgramOptimization>
+ <ExceptionHandling>false</ExceptionHandling>
+ <MinimalRebuild>false</MinimalRebuild>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\lib\$(Platform)\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>pthreadVC2.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <WarningLevel>Level3</WarningLevel>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <Optimization>Full</Optimization>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <PreprocessorDefinitions>NDEBUG;_CONSOLE;PTW32_STATIC_LIB;%(PreprocessorDefinitions);</PreprocessorDefinitions>
+ <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\include</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4996</DisableSpecificWarnings>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <ControlFlowGuard>false</ControlFlowGuard>
+ <EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
+ <FloatingPointModel>Fast</FloatingPointModel>
+ <CreateHotpatchableImage>false</CreateHotpatchableImage>
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <ExceptionHandling>false</ExceptionHandling>
+ <MinimalRebuild>false</MinimalRebuild>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ <GenerateDebugInformation>false</GenerateDebugInformation>
+ <AdditionalLibraryDirectories>$(SolutionDir)\..\..\..\Prerequisites\PthreadsW32\lib\$(Platform)\static;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <AdditionalDependencies>pthreadVC2.$(PlatformToolset).lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ </Link>
+ </ItemDefinitionGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="include\thread_utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\hd_table.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\boxmuller.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="include\msws.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="src\gen_table_ini.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+/* ----------------------------------------------------------------------------------------------- */
+/* MHash-384 - Generate tables utility program */
+/* Copyright(c) 2016-2018 LoRd_MuldeR <mulder2@gmx.de> */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining a copy of this software */
+/* and associated documentation files(the "Software"), to deal in the Software without */
+/* restriction, including without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the */
+/* Software is furnished to do so, subject to the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be included in all copies or */
+/* substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING */
+/* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
+/* NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
+/* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
+/* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/* ----------------------------------------------------------------------------------------------- */
+
+#include "common.h"
+#include "msws.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <time.h>
+#include <stdbool.h>
+#include <io.h>
+#include <float.h>
+#include <math.h>
+
+//-----------------------------------------------------------------------------
+// Const
+//-----------------------------------------------------------------------------
+
+#define HASH_LEN 384U
+#define DISTANCE_MIN (HASH_LEN / 2U)
+
+#define ENABLE_TRACE
+
+#define ROW_NUM 2U /*total number of rows*/
+#define ROW_LEN (HASH_LEN / CHAR_BIT) /*number of bits per row*/
+
+#define __DISTANCE_STR(X) #X
+#define _DISTANCE_STR(X) __DISTANCE_STR(X)
+#define DISTANCE_STR _DISTANCE_STR(DISTANCE_MIN)
+
+static const uint8_t RAND_DATA[ROW_LEN] =
+{
+ 0xEF, 0xDC, 0xB6, 0x6D, 0x4E, 0xCC, 0x1A, 0xA4, 0xAF, 0x9B, 0x3F, 0x20, 0x46, 0x98, 0xFA, 0xC6,
+ 0xA3, 0x06, 0xB4, 0x11, 0x98, 0x7C, 0x28, 0x2A, 0xE8, 0x92, 0x49, 0xC2, 0x64, 0xA9, 0xE1, 0xC8,
+ 0xA4, 0xAB, 0x93, 0x16, 0x1F, 0x35, 0x96, 0x77, 0x35, 0x2F, 0xC8, 0xB5, 0x6B, 0x6E, 0x37, 0xAE
+};
+
+//-----------------------------------------------------------------------------
+// Globals
+//-----------------------------------------------------------------------------
+
+static uint8_t g_table[ROW_NUM][ROW_LEN];
+
+static const char SPINNER[4] = { '/', '-', '\\', '|' };
+static const double SQRT2 = 1.41421356237309504880168872420969807856967187537694;
+
+static size_t g_spinpos = 0;
+
+//-----------------------------------------------------------------------------
+// Utility Functions
+//-----------------------------------------------------------------------------
+
+#ifdef ENABLE_TRACE
+#define TRACE(X, ...) printf("[TRACE] " X "\n", __VA_ARGS__)
+#else
+#define TRACE(X, ...) __noop()
+#endif
+
+static inline void print_row(uint8_t *const row_buffer)
+{
+ for (size_t w = 0; w < ROW_LEN; ++w)
+ {
+ printf("%02X", row_buffer[w]);
+ }
+ puts("");
+}
+
+static void dump_table(FILE *out)
+{
+ fprintf(out, "uint8_t MHASH_384_TABLE_INI[%uU][MHASH_384_LEN] =\n{\n", ROW_NUM);
+ for (size_t i = 0; i < ROW_NUM; i++)
+ {
+ fputs("\t{ ", out);
+ for (size_t j = 0; j < ROW_LEN; j++)
+ {
+ if (j > 0)
+ {
+ fputc(',', out);
+ }
+ fprintf(out, "0x%02X", g_table[i][j]);
+ }
+ fprintf(out, " }%s /*%02X*/\n", (i != (ROW_NUM - 1)) ? ", " : " ", (uint32_t)(i % 0x100));
+ }
+ fputs("};\n", out);
+}
+
+static bool check_buffer(const uint8_t *const a, const uint8_t *const b)
+{
+ static const uint8_t MAX_DIST = (CHAR_BIT / 2U) + 1U;
+ static const uint8_t MIN_DIST = (CHAR_BIT / 2U) - 1U;
+ for (uint_fast16_t i = 0; i < ROW_LEN; i++)
+ {
+ const uint8_t dist = HAMMING_DISTANCE_LUT[a[i]][b[i]];
+ if ((dist < MIN_DIST) || (dist > MAX_DIST))
+ {
+ return false;
+ }
+ if (((a[i] & 0x0F) == (b[i] & 0x0F)) || ((a[i] & 0xF0) == (b[i] & 0xF0)))
+ {
+ return false;
+ }
+ }
+ if (hamming_distance(g_table[0], g_table[1], ROW_LEN) != DISTANCE_MIN)
+ {
+ return false;
+ }
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+// MAIN
+//-----------------------------------------------------------------------------
+
+int wmain(int argc, wchar_t *argv[])
+{
+ msws_t rnd;
+
+ printf("MHash GenTableINI [%s]\n\n", __DATE__);
+ printf("HashLen: %d, Distance Min: %d, MSVC: %u\n\n", HASH_LEN, DISTANCE_MIN, _MSC_FULL_VER);
+
+ if ((HASH_LEN % (8 * sizeof(uint32_t))) != 0)
+ {
+ crit_exit("FATAL: Hash length must be a multiple of 32 bits!");
+ }
+
+ for (size_t i = 0; i < ROW_NUM; i++)
+ {
+ memset(&g_table[i][0], 0, sizeof(uint8_t) * ROW_LEN);
+ }
+
+ msws_init(rnd, make_seed());
+ memcpy(g_table[0], RAND_DATA, sizeof(uint8_t) * ROW_LEN);
+
+ printf("Table is being generated, please be patient...\n");
+ do
+ {
+ msws_bytes(rnd, g_table[1], ROW_LEN);
+ }
+ while (!check_buffer(g_table[0], g_table[1]));
+
+ printf("Done\n\n");
+ dump_table(stdout);
+
+ printf("\n-----\n\n");
+
+ printf("COMPLETED.\n\n");
+ return getchar();
+}