image-hash-native 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.idea/copilot.data.migration.ask2agent.xml +6 -0
  2. package/README.md +71 -0
  3. package/binding.gyp +50 -0
  4. package/build/Release/img_hash.exp +0 -0
  5. package/build/Release/img_hash.iobj +0 -0
  6. package/build/Release/img_hash.ipdb +0 -0
  7. package/build/Release/img_hash.lib +0 -0
  8. package/build/Release/img_hash.node +0 -0
  9. package/build/Release/img_hash.pdb +0 -0
  10. package/build/Release/nothing.lib +0 -0
  11. package/build/Release/obj/img_hash/img_hash.node.recipe +11 -0
  12. package/build/Release/obj/img_hash/img_hash.tlog/CL.command.1.tlog +0 -0
  13. package/build/Release/obj/img_hash/img_hash.tlog/CL.read.1.tlog +0 -0
  14. package/build/Release/obj/img_hash/img_hash.tlog/CL.write.1.tlog +0 -0
  15. package/build/Release/obj/img_hash/img_hash.tlog/Cl.items.tlog +2 -0
  16. package/build/Release/obj/img_hash/img_hash.tlog/img_hash.lastbuildstate +2 -0
  17. package/build/Release/obj/img_hash/img_hash.tlog/link.command.1.tlog +0 -0
  18. package/build/Release/obj/img_hash/img_hash.tlog/link.read.1.tlog +0 -0
  19. package/build/Release/obj/img_hash/img_hash.tlog/link.secondary.1.tlog +5 -0
  20. package/build/Release/obj/img_hash/img_hash.tlog/link.write.1.tlog +0 -0
  21. package/build/Release/obj/img_hash/src/addon.obj +0 -0
  22. package/build/Release/obj/img_hash/win_delay_load_hook.obj +0 -0
  23. package/build/binding.sln +45 -0
  24. package/build/img_hash.vcxproj +157 -0
  25. package/build/img_hash.vcxproj.filters +58 -0
  26. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/nothing.obj +0 -0
  27. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.lib.recipe +7 -0
  28. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/CL.command.1.tlog +0 -0
  29. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/CL.read.1.tlog +0 -0
  30. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/CL.write.1.tlog +0 -0
  31. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/Cl.items.tlog +2 -0
  32. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/Lib-link.read.1.tlog +0 -0
  33. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/Lib-link.write.1.tlog +0 -0
  34. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/Lib.command.1.tlog +0 -0
  35. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/nothing.tlog/nothing.lastbuildstate +2 -0
  36. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/Release/obj/nothing/win_delay_load_hook.obj +0 -0
  37. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/node_api.sln +19 -0
  38. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/nothing.vcxproj +141 -0
  39. package/build/node_modules/.pnpm/node-addon-api@8.5.0/node_modules/node-addon-api/nothing.vcxproj.filters +115 -0
  40. package/index.d.ts +9 -0
  41. package/index.js +54 -0
  42. package/package.json +22 -0
  43. package/src/addon.cpp +116 -0
  44. package/src/index.hpp +246 -0
  45. package/test.js +20 -0
@@ -0,0 +1,141 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|x64">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>x64</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|x64">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>x64</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <PropertyGroup Label="Globals">
14
+ <ProjectGuid>{D16AA5BB-0FAA-C315-8B42-674B7FC329B3}</ProjectGuid>
15
+ <Keyword>Win32Proj</Keyword>
16
+ <RootNamespace>nothing</RootNamespace>
17
+ <IgnoreWarnCompileDuplicatedFilename>true</IgnoreWarnCompileDuplicatedFilename>
18
+ <PreferredToolArchitecture>x64</PreferredToolArchitecture>
19
+ <WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
20
+ </PropertyGroup>
21
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props"/>
22
+ <PropertyGroup Label="Configuration">
23
+ <ConfigurationType>StaticLibrary</ConfigurationType>
24
+ </PropertyGroup>
25
+ <PropertyGroup Label="Locals">
26
+ <PlatformToolset>v143</PlatformToolset>
27
+ </PropertyGroup>
28
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props"/>
29
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props"/>
30
+ <ImportGroup Label="ExtensionSettings"/>
31
+ <ImportGroup Label="PropertySheets">
32
+ <Import Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"/>
33
+ </ImportGroup>
34
+ <PropertyGroup Label="UserMacros"/>
35
+ <PropertyGroup>
36
+ <ExecutablePath>$(ExecutablePath);$(MSBuildProjectDirectory)\..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\bin\;$(MSBuildProjectDirectory)\..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\bin\</ExecutablePath>
37
+ <IntDir>$(Configuration)\obj\$(ProjectName)\</IntDir>
38
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
39
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
40
+ <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
41
+ <TargetName>$(ProjectName)</TargetName>
42
+ <TargetPath>$(OutDir)\$(ProjectName)$(TargetExt)</TargetPath>
43
+ </PropertyGroup>
44
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
45
+ <ClCompile>
46
+ <AdditionalIncludeDirectories>C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\include\node;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\src;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\config;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\openssl\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\uv\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\zlib;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
47
+ <AdditionalOptions>/Zc:__cplusplus -std:c++20 /Zm2000 %(AdditionalOptions)</AdditionalOptions>
48
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
49
+ <BufferSecurityCheck>true</BufferSecurityCheck>
50
+ <DebugInformationFormat>OldStyle</DebugInformationFormat>
51
+ <DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
52
+ <ExceptionHandling>false</ExceptionHandling>
53
+ <MinimalRebuild>false</MinimalRebuild>
54
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
55
+ <OmitFramePointers>false</OmitFramePointers>
56
+ <Optimization>Disabled</Optimization>
57
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
58
+ <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=nothing;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
59
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
60
+ <StringPooling>true</StringPooling>
61
+ <SuppressStartupBanner>true</SuppressStartupBanner>
62
+ <TreatWarningAsError>false</TreatWarningAsError>
63
+ <WarningLevel>Level3</WarningLevel>
64
+ <WholeProgramOptimization>true</WholeProgramOptimization>
65
+ </ClCompile>
66
+ <Lib>
67
+ <AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
68
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
69
+ </Lib>
70
+ <Link>
71
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;delayimp.lib;&quot;C:\\Users\\tinar\\AppData\\Local\\node-gyp\\Cache\\22.18.0\\x64\\node.lib&quot;</AdditionalDependencies>
72
+ <AdditionalOptions>/LTCG:INCREMENTAL /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
73
+ <DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
74
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
75
+ <GenerateDebugInformation>true</GenerateDebugInformation>
76
+ <OptimizeReferences>true</OptimizeReferences>
77
+ <SuppressStartupBanner>true</SuppressStartupBanner>
78
+ <TargetMachine>MachineX64</TargetMachine>
79
+ </Link>
80
+ <ResourceCompile>
81
+ <AdditionalIncludeDirectories>C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\include\node;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\src;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\config;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\openssl\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\uv\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\zlib;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
82
+ <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=nothing;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;DEBUG;_DEBUG;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
83
+ </ResourceCompile>
84
+ </ItemDefinitionGroup>
85
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
86
+ <ClCompile>
87
+ <AdditionalIncludeDirectories>C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\include\node;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\src;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\config;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\openssl\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\uv\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\zlib;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
88
+ <AdditionalOptions>/Zc:__cplusplus -std:c++20 /Zm2000 %(AdditionalOptions)</AdditionalOptions>
89
+ <BufferSecurityCheck>true</BufferSecurityCheck>
90
+ <DebugInformationFormat>OldStyle</DebugInformationFormat>
91
+ <DisableSpecificWarnings>4351;4355;4800;4251;4275;4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
92
+ <ExceptionHandling>false</ExceptionHandling>
93
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
94
+ <FunctionLevelLinking>true</FunctionLevelLinking>
95
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
96
+ <IntrinsicFunctions>true</IntrinsicFunctions>
97
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
98
+ <OmitFramePointers>true</OmitFramePointers>
99
+ <Optimization>Full</Optimization>
100
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
101
+ <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=nothing;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;%(PreprocessorDefinitions)</PreprocessorDefinitions>
102
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
103
+ <RuntimeTypeInfo>false</RuntimeTypeInfo>
104
+ <StringPooling>true</StringPooling>
105
+ <SuppressStartupBanner>true</SuppressStartupBanner>
106
+ <TreatWarningAsError>false</TreatWarningAsError>
107
+ <WarningLevel>Level3</WarningLevel>
108
+ <WholeProgramOptimization>true</WholeProgramOptimization>
109
+ </ClCompile>
110
+ <Lib>
111
+ <AdditionalOptions>/LTCG:INCREMENTAL %(AdditionalOptions)</AdditionalOptions>
112
+ <OutputFile>$(OutDir)$(ProjectName)$(TargetExt)</OutputFile>
113
+ </Lib>
114
+ <Link>
115
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;delayimp.lib;&quot;C:\\Users\\tinar\\AppData\\Local\\node-gyp\\Cache\\22.18.0\\x64\\node.lib&quot;</AdditionalDependencies>
116
+ <AdditionalOptions>/LTCG:INCREMENTAL /ignore:4199 %(AdditionalOptions)</AdditionalOptions>
117
+ <DelayLoadDLLs>node.exe;%(DelayLoadDLLs)</DelayLoadDLLs>
118
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
119
+ <GenerateDebugInformation>true</GenerateDebugInformation>
120
+ <OptimizeReferences>true</OptimizeReferences>
121
+ <SuppressStartupBanner>true</SuppressStartupBanner>
122
+ <TargetMachine>MachineX64</TargetMachine>
123
+ </Link>
124
+ <ResourceCompile>
125
+ <AdditionalIncludeDirectories>C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\include\node;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\src;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\config;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\openssl\openssl\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\uv\include;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\zlib;C:\Users\tinar\AppData\Local\node-gyp\Cache\22.18.0\deps\v8\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
126
+ <PreprocessorDefinitions>NODE_GYP_MODULE_NAME=nothing;USING_UV_SHARED=1;USING_V8_SHARED=1;V8_DEPRECATION_WARNINGS=1;_GLIBCXX_USE_CXX11_ABI=1;_FILE_OFFSET_BITS=64;WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_HAS_EXCEPTIONS=0;NOMINMAX;OPENSSL_NO_PINSHARED;OPENSSL_THREADS;HOST_BINARY=&quot;node.exe&quot;;%(PreprocessorDefinitions);%(PreprocessorDefinitions)</PreprocessorDefinitions>
127
+ </ResourceCompile>
128
+ </ItemDefinitionGroup>
129
+ <ItemGroup>
130
+ <None Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\node_api.gyp"/>
131
+ </ItemGroup>
132
+ <ItemGroup>
133
+ <ClCompile Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\nothing.c">
134
+ <ObjectFileName>$(IntDir)\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\nothing.obj</ObjectFileName>
135
+ </ClCompile>
136
+ <ClCompile Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0\node_modules\node-gyp\src\win_delay_load_hook.cc"/>
137
+ </ItemGroup>
138
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
139
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets"/>
140
+ <ImportGroup Label="ExtensionTargets"/>
141
+ </Project>
@@ -0,0 +1,115 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup>
4
+ <Filter Include="..">
5
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
6
+ </Filter>
7
+ <Filter Include="..\..">
8
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
9
+ </Filter>
10
+ <Filter Include="..\..\..">
11
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
12
+ </Filter>
13
+ <Filter Include="..\..\..\..">
14
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
15
+ </Filter>
16
+ <Filter Include="..\..\..\..\..">
17
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
18
+ </Filter>
19
+ <Filter Include="..\..\..\..\..\..">
20
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
21
+ </Filter>
22
+ <Filter Include="..\..\..\..\..\..\node_modules">
23
+ <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
24
+ </Filter>
25
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm">
26
+ <UniqueIdentifier>{293CE058-3CF8-8B4D-C9A0-FD024AF736DB}</UniqueIdentifier>
27
+ </Filter>
28
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0">
29
+ <UniqueIdentifier>{E33176EB-66C9-58BC-82C1-B6A22D2EB809}</UniqueIdentifier>
30
+ </Filter>
31
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules">
32
+ <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
33
+ </Filter>
34
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api">
35
+ <UniqueIdentifier>{A353D9AF-FDFE-F893-56AE-2F252738A960}</UniqueIdentifier>
36
+ </Filter>
37
+ <Filter Include="C:">
38
+ <UniqueIdentifier>{7B735499-E5DD-1C2B-6C26-70023832A1CF}</UniqueIdentifier>
39
+ </Filter>
40
+ <Filter Include="C:\Users">
41
+ <UniqueIdentifier>{E9F714C1-DA89-54E2-60CF-39FEB20BF756}</UniqueIdentifier>
42
+ </Filter>
43
+ <Filter Include="C:\Users\tinar">
44
+ <UniqueIdentifier>{E4181FEF-40DE-A68A-9710-04148DE17DA4}</UniqueIdentifier>
45
+ </Filter>
46
+ <Filter Include="C:\Users\tinar\WebstormProjects">
47
+ <UniqueIdentifier>{1BE06873-5E24-6012-F79E-EC2F7B02B909}</UniqueIdentifier>
48
+ </Filter>
49
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash">
50
+ <UniqueIdentifier>{5C8E9DD2-39C9-7984-A5ED-436FBCF03341}</UniqueIdentifier>
51
+ </Filter>
52
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules">
53
+ <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
54
+ </Filter>
55
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm">
56
+ <UniqueIdentifier>{293CE058-3CF8-8B4D-C9A0-FD024AF736DB}</UniqueIdentifier>
57
+ </Filter>
58
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0">
59
+ <UniqueIdentifier>{F772891E-BC75-D5CD-4728-55F5D332D75E}</UniqueIdentifier>
60
+ </Filter>
61
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0\node_modules">
62
+ <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
63
+ </Filter>
64
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0\node_modules\node-gyp">
65
+ <UniqueIdentifier>{77348C0E-2034-7791-74D5-63C077DF5A3B}</UniqueIdentifier>
66
+ </Filter>
67
+ <Filter Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0\node_modules\node-gyp\src">
68
+ <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
69
+ </Filter>
70
+ <Filter Include="..">
71
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
72
+ </Filter>
73
+ <Filter Include="..\..">
74
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
75
+ </Filter>
76
+ <Filter Include="..\..\..">
77
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
78
+ </Filter>
79
+ <Filter Include="..\..\..\..">
80
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
81
+ </Filter>
82
+ <Filter Include="..\..\..\..\..">
83
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
84
+ </Filter>
85
+ <Filter Include="..\..\..\..\..\..">
86
+ <UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
87
+ </Filter>
88
+ <Filter Include="..\..\..\..\..\..\node_modules">
89
+ <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
90
+ </Filter>
91
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm">
92
+ <UniqueIdentifier>{293CE058-3CF8-8B4D-C9A0-FD024AF736DB}</UniqueIdentifier>
93
+ </Filter>
94
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0">
95
+ <UniqueIdentifier>{E33176EB-66C9-58BC-82C1-B6A22D2EB809}</UniqueIdentifier>
96
+ </Filter>
97
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules">
98
+ <UniqueIdentifier>{56DF7A98-063D-FB9D-485C-089023B4C16A}</UniqueIdentifier>
99
+ </Filter>
100
+ <Filter Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api">
101
+ <UniqueIdentifier>{A353D9AF-FDFE-F893-56AE-2F252738A960}</UniqueIdentifier>
102
+ </Filter>
103
+ </ItemGroup>
104
+ <ItemGroup>
105
+ <ClCompile Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\nothing.c">
106
+ <Filter>..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api</Filter>
107
+ </ClCompile>
108
+ <ClCompile Include="C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0\node_modules\node-gyp\src\win_delay_load_hook.cc">
109
+ <Filter>C:\Users\tinar\WebstormProjects\image-hash\node_modules\.pnpm\node-gyp@12.1.0\node_modules\node-gyp\src</Filter>
110
+ </ClCompile>
111
+ <None Include="..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api\node_api.gyp">
112
+ <Filter>..\..\..\..\..\..\node_modules\.pnpm\node-addon-api@8.5.0\node_modules\node-addon-api</Filter>
113
+ </None>
114
+ </ItemGroup>
115
+ </Project>
package/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+
3
+ export function aHash(buffer: Buffer, width: number, height: number): bigint;
4
+
5
+ export function dHash(buffer: Buffer, width: number, height: number): bigint;
6
+
7
+ export function pHash(buffer: Buffer, width: number, height: number): bigint;
8
+
9
+ export function hamming(hash1: bigint, hash2: bigint): number;
package/index.js ADDED
@@ -0,0 +1,54 @@
1
+ const imgHash = require('./build/Release/img_hash.node');
2
+
3
+ function aHash(buffer, width, height) {
4
+ if (!Buffer.isBuffer(buffer)) {
5
+ throw new TypeError('First argument must be a Buffer');
6
+ }
7
+ if (typeof width !== 'number' || typeof height !== 'number') {
8
+ throw new TypeError('Width and height must be numbers');
9
+ }
10
+ if (width <= 0 || height <= 0) {
11
+ throw new RangeError('Width and height must be positive');
12
+ }
13
+ return imgHash.aHash(buffer, width, height);
14
+ }
15
+
16
+ function dHash(buffer, width, height) {
17
+ if (!Buffer.isBuffer(buffer)) {
18
+ throw new TypeError('First argument must be a Buffer');
19
+ }
20
+ if (typeof width !== 'number' || typeof height !== 'number') {
21
+ throw new TypeError('Width and height must be numbers');
22
+ }
23
+ if (width <= 0 || height <= 0) {
24
+ throw new RangeError('Width and height must be positive');
25
+ }
26
+ return imgHash.dHash(buffer, width, height);
27
+ }
28
+
29
+ function pHash(buffer, width, height) {
30
+ if (!Buffer.isBuffer(buffer)) {
31
+ throw new TypeError('First argument must be a Buffer');
32
+ }
33
+ if (typeof width !== 'number' || typeof height !== 'number') {
34
+ throw new TypeError('Width and height must be numbers');
35
+ }
36
+ if (width <= 0 || height <= 0) {
37
+ throw new RangeError('Width and height must be positive');
38
+ }
39
+ return imgHash.pHash(buffer, width, height);
40
+ }
41
+
42
+ function hamming(hash1, hash2) {
43
+ if (typeof hash1 !== 'bigint' || typeof hash2 !== 'bigint') {
44
+ throw new TypeError('Arguments must be BigInt');
45
+ }
46
+ return imgHash.hamming(hash1, hash2);
47
+ }
48
+
49
+ module.exports = {
50
+ aHash,
51
+ dHash,
52
+ pHash,
53
+ hamming
54
+ };
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "image-hash-native",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "gypfile": true,
8
+ "scripts": {
9
+ "install": "node-gyp rebuild",
10
+ "build": "node-gyp rebuild",
11
+ "clean": "node-gyp clean"
12
+ },
13
+ "keywords": [],
14
+ "author": "Tinnaphat Somsang <tinvv@outlook.co.th>",
15
+ "license": "MIT",
16
+ "packageManager": "pnpm@10.6.1",
17
+ "devDependencies": {
18
+ "@types/node": "^25.0.3",
19
+ "node-addon-api": "^8.5.0",
20
+ "node-gyp": "^12.1.0"
21
+ }
22
+ }
package/src/addon.cpp ADDED
@@ -0,0 +1,116 @@
1
+ #include "index.hpp"
2
+ #include <napi.h>
3
+
4
+ namespace {
5
+
6
+ inline void GetImageBuffer(const Napi::CallbackInfo &info, const uint8_t **data,
7
+ size_t *size, size_t *width, size_t *height) {
8
+ if (info.Length() < 3) {
9
+ throw Napi::Error::New(info.Env(), "Expected 3 arguments: buffer, width, height");
10
+ }
11
+
12
+ if (!info[0].IsBuffer()) {
13
+ throw Napi::TypeError::New(info.Env(), "First argument must be a Buffer");
14
+ }
15
+
16
+ if (!info[1].IsNumber() || !info[2].IsNumber()) {
17
+ throw Napi::TypeError::New(info.Env(), "Width and height must be numbers");
18
+ }
19
+
20
+ Napi::Buffer<uint8_t> buffer = info[0].As<Napi::Buffer<uint8_t>>();
21
+ *data = buffer.Data();
22
+ *size = buffer.Length();
23
+ *width = info[1].As<Napi::Number>().Int64Value();
24
+ *height = info[2].As<Napi::Number>().Int64Value();
25
+
26
+ if (*width <= 0 || *height <= 0) {
27
+ throw Napi::Error::New(info.Env(), "Width and height must be positive");
28
+ }
29
+
30
+ size_t expected_size = (*width) * (*height) * 3;
31
+ if (*size < expected_size) {
32
+ throw Napi::Error::New(info.Env(), "Buffer too small: expected at least " + std::to_string(expected_size) + " bytes, got " + std::to_string(*size));
33
+ }
34
+ }
35
+
36
+ Napi::Value AHashWrapped(const Napi::CallbackInfo &info) {
37
+ try {
38
+ const uint8_t *data;
39
+ size_t size, w, h;
40
+ GetImageBuffer(info, &data, &size, &w, &h);
41
+
42
+ size_t stride = w * 3;
43
+ uint64_t hash = img_hash::aHash(data, w, h, stride);
44
+
45
+ return Napi::BigInt::New(info.Env(), hash);
46
+ } catch (const std::exception &e) {
47
+ throw Napi::Error::New(info.Env(), e.what());
48
+ }
49
+ }
50
+
51
+ Napi::Value DHashWrapped(const Napi::CallbackInfo &info) {
52
+ try {
53
+ const uint8_t *data;
54
+ size_t size, w, h;
55
+ GetImageBuffer(info, &data, &size, &w, &h);
56
+
57
+ size_t stride = w * 3;
58
+ uint64_t hash = img_hash::dHash(data, w, h, stride);
59
+
60
+ return Napi::BigInt::New(info.Env(), hash);
61
+ } catch (const std::exception &e) {
62
+ throw Napi::Error::New(info.Env(), e.what());
63
+ }
64
+ }
65
+
66
+ Napi::Value PHashWrapped(const Napi::CallbackInfo &info) {
67
+ try {
68
+ const uint8_t *data;
69
+ size_t size, w, h;
70
+ GetImageBuffer(info, &data, &size, &w, &h);
71
+
72
+ size_t stride = w * 3;
73
+ uint64_t hash = img_hash::pHash(data, w, h, stride);
74
+
75
+ return Napi::BigInt::New(info.Env(), hash);
76
+ } catch (const std::exception &e) {
77
+ throw Napi::Error::New(info.Env(), e.what());
78
+ }
79
+ }
80
+
81
+ Napi::Value HammingWrapped(const Napi::CallbackInfo &info) {
82
+ try {
83
+ if (info.Length() < 2) {
84
+ throw Napi::Error::New(info.Env(), "Expected 2 arguments");
85
+ }
86
+
87
+ if (!info[0].IsBigInt() || !info[1].IsBigInt()) {
88
+ throw Napi::TypeError::New(info.Env(), "Arguments must be BigInt");
89
+ }
90
+
91
+ bool lossless1, lossless2;
92
+ uint64_t h1 = info[0].As<Napi::BigInt>().Uint64Value(&lossless1);
93
+ uint64_t h2 = info[1].As<Napi::BigInt>().Uint64Value(&lossless2);
94
+
95
+ if (!lossless1 || !lossless2) {
96
+ throw Napi::Error::New(info.Env(), "BigInt conversion lost precision");
97
+ }
98
+
99
+ int dist = img_hash::hamming(h1, h2);
100
+ return Napi::Number::New(info.Env(), dist);
101
+ } catch (const std::exception &e) {
102
+ throw Napi::Error::New(info.Env(), e.what());
103
+ }
104
+ }
105
+
106
+ Napi::Object Init(Napi::Env env, Napi::Object exports) {
107
+ exports.Set("aHash", Napi::Function::New(env, AHashWrapped));
108
+ exports.Set("dHash", Napi::Function::New(env, DHashWrapped));
109
+ exports.Set("pHash", Napi::Function::New(env, PHashWrapped));
110
+ exports.Set("hamming", Napi::Function::New(env, HammingWrapped));
111
+ return exports;
112
+ }
113
+
114
+ } // namespace
115
+
116
+ NODE_API_MODULE(img_hash, Init)