diff --git a/src/Miningcore/Crypto/Hashing/Algorithms/YespowerMGPC.cs b/src/Miningcore/Crypto/Hashing/Algorithms/YespowerMGPC.cs new file mode 100644 index 000000000..e98076b7d --- /dev/null +++ b/src/Miningcore/Crypto/Hashing/Algorithms/YespowerMGPC.cs @@ -0,0 +1,21 @@ +using Miningcore.Contracts; +using Miningcore.Native; + +namespace Miningcore.Crypto.Hashing.Algorithms; + +[Identifier("yespowermgpc")] +public unsafe class YespowerMGPC : IHashAlgorithm +{ + public void Digest(ReadOnlySpan data, Span result, params object[] extra) + { + Contract.Requires(result.Length >= 32); + + fixed (byte* input = data) + { + fixed (byte* output = result) + { + Multihash.yespowerMGPC(input, output, (uint) data.Length); + } + } + } +} diff --git a/src/Miningcore/Native/Multihash.cs b/src/Miningcore/Native/Multihash.cs index 9384d1a65..d08d87741 100644 --- a/src/Miningcore/Native/Multihash.cs +++ b/src/Miningcore/Native/Multihash.cs @@ -214,6 +214,9 @@ public static unsafe class Multihash [DllImport("libmultihash", EntryPoint = "yespowerR16_export", CallingConvention = CallingConvention.Cdecl)] public static extern void yespowerR16(byte* input, void* output, uint inputLength); + [DllImport("libmultihash", EntryPoint = "yespowerMGPC_export", CallingConvention = CallingConvention.Cdecl)] + public static extern void yespowerMGPC(byte* input, void* output, uint inputLength); + [DllImport("libmultihash", EntryPoint = "yespowerTIDE_export", CallingConvention = CallingConvention.Cdecl)] public static extern void yespowerTIDE(byte* input, void* output, uint inputLength); diff --git a/src/Native/libmultihash/exports.cpp b/src/Native/libmultihash/exports.cpp index b258398dd..f021c75de 100644 --- a/src/Native/libmultihash/exports.cpp +++ b/src/Native/libmultihash/exports.cpp @@ -427,6 +427,11 @@ extern "C" MODULE_API void yespowerIC_export(const char *input, char *output, ui yespowerIC_hash(input, output, input_len); } +extern "C" MODULE_API void yespowerMGPC_export(const char *input, char *output, uint32_t input_len) +{ + yespowerMGPC_hash(input, output, input_len); +} + extern "C" MODULE_API void yespowerR16_export(const char *input, char *output, uint32_t input_len) { yespowerR16_hash(input, output, input_len);