OSDN Git Service

Added language binding for Python.
authorLoRd_MuldeR <mulder2@gmx.de>
Fri, 25 Mar 2016 14:04:48 +0000 (15:04 +0100)
committerLoRd_MuldeR <mulder2@gmx.de>
Fri, 25 Mar 2016 14:04:48 +0000 (15:04 +0100)
.gitignore
bindings/Python/wrapper/MHashPy384.sln [new file with mode: 0644]
bindings/Python/wrapper/MHashPy384.vcxproj [new file with mode: 0644]
bindings/Python/wrapper/MHashPy384.vcxproj.filters [new file with mode: 0644]
bindings/Python/wrapper/src/MHashPy384.cpp [new file with mode: 0644]
bindings/Python/wrapper/src/dllmain.cpp [new file with mode: 0644]

index e019926..8f5f94f 100644 (file)
@@ -15,6 +15,8 @@
 /bindings/Microsoft.NET/MHashDotNet384.Wrapper/obj
 /bindings/Microsoft.NET/bin
 /bindings/Microsoft.NET/ipch
+/bindings/Python/wrapper/bin
+/bindings/Python/wrapper/obj
 /ipch
 /obj
 /out
diff --git a/bindings/Python/wrapper/MHashPy384.sln b/bindings/Python/wrapper/MHashPy384.sln
new file mode 100644 (file)
index 0000000..b2f3688
--- /dev/null
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.24720.0
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MHashPy384", "MHashPy384.vcxproj", "{98971AF0-1B4D-4B5A-A174-9B099F7977B8}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|x64 = Debug|x64
+               Debug|x86 = Debug|x86
+               Release|x64 = Release|x64
+               Release|x86 = Release|x86
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x64.ActiveCfg = Debug|x64
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x64.Build.0 = Debug|x64
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x86.ActiveCfg = Debug|Win32
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Debug|x86.Build.0 = Debug|Win32
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x64.ActiveCfg = Release|x64
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x64.Build.0 = Release|x64
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x86.ActiveCfg = Release|Win32
+               {98971AF0-1B4D-4B5A-A174-9B099F7977B8}.Release|x86.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/bindings/Python/wrapper/MHashPy384.vcxproj b/bindings/Python/wrapper/MHashPy384.vcxproj
new file mode 100644 (file)
index 0000000..9c0e5a1
--- /dev/null
@@ -0,0 +1,191 @@
+<?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\dllmain.cpp" />
+    <ClCompile Include="src\MHashPy384.cpp" />
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{98971AF0-1B4D-4B5A-A174-9B099F7977B8}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>MHashPy384</RootNamespace>
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v140_xp</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v140_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\$(PlatformShortName)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+    <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+    <TargetExt>.pyd</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+    <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+    <TargetExt>.pyd</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+    <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+    <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+    <TargetExt>.pyd</TargetExt>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <OutDir>$(SolutionDir)\bin\$(PlatformShortName)\$(Configuration)\</OutDir>
+    <IntDir>$(SolutionDir)\obj\$(PlatformShortName)\$(Configuration)\</IntDir>
+    <TargetName>$(ProjectName).$(PlatformShortName)</TargetName>
+    <TargetExt>.pyd</TargetExt>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(PYTHON_HOME_X86)\include</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>$(PYTHON_HOME_X86)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(PYTHON_HOME_X64)\include</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>$(PYTHON_HOME_X64)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>Full</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(PYTHON_HOME_X86)\include</AdditionalIncludeDirectories>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <WholeProgramOptimization>true</WholeProgramOptimization>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>No</GenerateDebugInformation>
+      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+      <AdditionalLibraryDirectories>$(PYTHON_HOME_X86)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>Full</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;MHASHJAVA384_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(SolutionDir)\include;$(SolutionDir)\..\..\..\include;$(PYTHON_HOME_X64)\include</AdditionalIncludeDirectories>
+      <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
+      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+      <OmitFramePointers>true</OmitFramePointers>
+      <WholeProgramOptimization>true</WholeProgramOptimization>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
+      <CreateHotpatchableImage>false</CreateHotpatchableImage>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>No</GenerateDebugInformation>
+      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+      <AdditionalLibraryDirectories>$(PYTHON_HOME_X64)\libs;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+    </Link>
+  </ItemDefinitionGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/bindings/Python/wrapper/MHashPy384.vcxproj.filters b/bindings/Python/wrapper/MHashPy384.vcxproj.filters
new file mode 100644 (file)
index 0000000..b3baaa9
--- /dev/null
@@ -0,0 +1,25 @@
+<?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>
+    <ClCompile Include="src\dllmain.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+    <ClCompile Include="src\MHashPy384.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/bindings/Python/wrapper/src/MHashPy384.cpp b/bindings/Python/wrapper/src/MHashPy384.cpp
new file mode 100644 (file)
index 0000000..10f3baf
--- /dev/null
@@ -0,0 +1,151 @@
+/* ---------------------------------------------------------------------------------------------- */
+/* MHash-384 - Language bindings for Java                                                         */
+/* Copyright(c) 2016 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.        */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define MHASH_DISABLE_STL 1
+
+#include <mhash_384.h>
+#include <Python.h>
+
+/* ------------------------------------------------------------------------*/
+/* METHOD IMPLEMENTATION                                                   */
+/* ------------------------------------------------------------------------*/
+
+static PyObject *MHash384_Create(PyObject *const self, PyObject *const args)
+{
+       return PyLong_FromVoidPtr(new mhash::MHash384());
+}
+
+static PyObject *MHash384_Update(PyObject *const self, PyObject *const args)
+{
+       PyObject *instance = NULL, *data = NULL;
+       if (PyArg_UnpackTuple(args, "MHash384_Update", 2, 2, &instance, &data))
+       {
+               if (PyLong_Check(instance) && PyBytes_Check(data))
+               {
+                       void *const inst_ptr = PyLong_AsVoidPtr(instance);
+                       if (inst_ptr)
+                       {
+                               reinterpret_cast<mhash::MHash384*>(inst_ptr)->update(reinterpret_cast<uint8_t*>(PyBytes_AsString(data)), PyBytes_Size(data));
+                               Py_RETURN_TRUE;
+                       }
+               }
+       }
+       Py_RETURN_FALSE;
+}
+
+static PyObject *MHash384_Result(PyObject *const self, PyObject *const args)
+{
+       uint8_t buffer[MHASH_384_LEN];
+       PyObject *instance = NULL;
+       if (PyArg_UnpackTuple(args, "MHash384_Update", 1, 1, &instance))
+       {
+               if (PyLong_Check(instance))
+               {
+                       void *const inst_ptr = PyLong_AsVoidPtr(instance);
+                       if (inst_ptr)
+                       {
+                               reinterpret_cast<mhash::MHash384*>(inst_ptr)->finalize(buffer);
+                               return PyByteArray_FromStringAndSize(reinterpret_cast<const char*>(buffer), MHASH_384_LEN);
+                       }
+               }
+       }
+       Py_RETURN_NONE;
+}
+
+static PyObject *MHash384_FreeUp(PyObject *const self, PyObject *const args)
+{
+       PyObject *instance = NULL;
+       if (PyArg_UnpackTuple(args, "MHash384_Update", 1, 1, &instance))
+       {
+               if (PyLong_Check(instance))
+               {
+                       void *const inst_ptr = PyLong_AsVoidPtr(instance);
+                       if (inst_ptr)
+                       {
+                               delete reinterpret_cast<mhash::MHash384*>(inst_ptr);
+                               Py_RETURN_TRUE;
+                       }
+               }
+       }
+       Py_RETURN_FALSE;
+}
+
+/* ------------------------------------------------------------------------*/
+/* MODULE INTERFACCE                                                       */
+/* ------------------------------------------------------------------------*/
+
+static PyMethodDef MHash384_Methods[] =
+{
+       {"create", MHash384_Create, METH_NOARGS,  "Create a new MHash384 instance and initialize it."},
+       {"update", MHash384_Update, METH_VARARGS, "Process next N bytes of input data. Pass the MHash384 instance followed by a PyBytes object."},
+       {"result", MHash384_Result, METH_VARARGS, "Return the final hash (digest) value."},
+       {"freeup", MHash384_FreeUp, METH_VARARGS, "Destorys an existing instace and frees all its memory."},
+       {NULL, NULL, 0, NULL}
+};
+
+static struct PyModuleDef MHash384_ModuleDef =
+{
+       PyModuleDef_HEAD_INIT, "MHash384", "", -1, MHash384_Methods
+};
+
+PyMODINIT_FUNC
+PyInit_MHash384(void)
+{
+       return PyModule_Create(&MHash384_ModuleDef);
+}
+
+/*
+JNIEXPORT jlong JNICALL Java_mhash_MHash384_00024Internals_createInstance(JNIEnv*, jclass)
+{
+       return reinterpret_cast<jlong>(new mhash::MHash384());
+}
+
+JNIEXPORT void JNICALL Java_mhash_MHash384_00024Internals_update(JNIEnv *const env, jclass, const jlong instance, const jbyteArray input, const jint offset, const jint len)
+{
+       jbyte *const input_ptr = env->GetByteArrayElements(input, NULL);
+       reinterpret_cast<mhash::MHash384*>(instance)->update(reinterpret_cast<uint8_t*>(input_ptr + offset), len);
+       env->ReleaseByteArrayElements(input, input_ptr, JNI_ABORT);
+}
+
+JNIEXPORT jbyteArray JNICALL Java_mhash_MHash384_00024Internals_finalize(JNIEnv *const env, jclass, const jlong instance)
+{
+       const jbyteArray result = env->NewByteArray(MHASH_384_LEN);
+       jbyte *const result_ptr = env->GetByteArrayElements(result, NULL);
+       reinterpret_cast<mhash::MHash384*>(instance)->finalize(reinterpret_cast<uint8_t*>(result_ptr));
+       env->ReleaseByteArrayElements(result, result_ptr, 0);
+       return result;
+}
+
+JNIEXPORT void JNICALL Java_mhash_MHash384_00024Internals_destroyInstance(JNIEnv*, jclass, const jlong instance)
+{
+       delete reinterpret_cast<mhash::MHash384*>(instance);
+}
+
+JNIEXPORT jintArray JNICALL Java_mhash_MHash384_00024Internals_getVersion(JNIEnv *const env, jclass)
+{
+       const jintArray version = env->NewIntArray(3);
+       jint *const version_ptr = env->GetIntArrayElements(version, NULL);
+       version_ptr[0] = (jint) MHASH_384_VERSION_MAJOR;
+       version_ptr[1] = (jint) MHASH_384_VERSION_MINOR;
+       version_ptr[2] = (jint) MHASH_384_VERSION_PATCH;
+       env->ReleaseIntArrayElements(version, version_ptr, 0);
+       return version;
+}
+*/
diff --git a/bindings/Python/wrapper/src/dllmain.cpp b/bindings/Python/wrapper/src/dllmain.cpp
new file mode 100644 (file)
index 0000000..747a984
--- /dev/null
@@ -0,0 +1,35 @@
+/* ---------------------------------------------------------------------------------------------- */
+/* MHash-384 - Language bindings for Java                                                         */
+/* Copyright(c) 2016 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.        */
+/* ---------------------------------------------------------------------------------------------- */
+
+#define WIN32_LEAN_AND_MEAN 1
+#include <Windows.h>
+
+BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
+{
+       switch (ul_reason_for_call)
+       {
+       case DLL_PROCESS_ATTACH:
+       case DLL_THREAD_ATTACH:
+       case DLL_THREAD_DETACH:
+       case DLL_PROCESS_DETACH:
+               break;
+       }
+       return TRUE;
+}