1 /* ---------------------------------------------------------------------------------------------- */
2 /* MHash-384 - Language bindings for Delphi */
3 /* Copyright(c) 2016 LoRd_MuldeR <mulder2@gmx.de> */
5 /* Permission is hereby granted, free of charge, to any person obtaining a copy of this software */
6 /* and associated documentation files (the "Software"), to deal in the Software without */
7 /* restriction, including without limitation the rights to use, copy, modify, merge, publish, */
8 /* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the */
9 /* Software is furnished to do so, subject to the following conditions: */
11 /* The above copyright notice and this permission notice shall be included in all copies or */
12 /* substantial portions of the Software. */
14 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING */
15 /* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND */
16 /* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, */
17 /* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, */
18 /* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
19 /* ---------------------------------------------------------------------------------------------- */
21 #define MHASH_DISABLE_STL 1
22 #include <mhash_384.h>
25 #define EXPORT_FUNC(NAME,TYPE,...) extern "C" __declspec(dllexport) TYPE NAME(__VA_ARGS__)
27 #define EXPORT_FUNC(NAME,TYPE,...) __declspec(dllexport) TYPE NAME(__VA_ARGS__)
30 EXPORT_FUNC(mhash384_create, uintptr_t, void)
32 return (uintptr_t) new mhash::MHash384();
35 EXPORT_FUNC(mhash384_update, void, const uintptr_t instance, uint8_t *const input, const size_t offset, const size_t len)
37 reinterpret_cast<mhash::MHash384*>(instance)->update(input + offset, len);
40 EXPORT_FUNC(mhash384_result, void, const uintptr_t instance, uint8_t *const buffer)
42 reinterpret_cast<mhash::MHash384*>(instance)->finalize(buffer);
45 EXPORT_FUNC(mhash384_freeup, void, const uintptr_t instance)
47 delete reinterpret_cast<mhash::MHash384*>(instance);
50 EXPORT_FUNC(mhash384_getver, void, uint32_t *const major, uint32_t *const minor, uint32_t *const patch)
52 *major = MHASH_384_VERSION_MAJOR;
53 *minor = MHASH_384_VERSION_MINOR;
54 *patch = MHASH_384_VERSION_PATCH;