Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Kezzak.cs #78

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
using Miningcore.Contracts;
using Miningcore.Extensions;
using Miningcore.Native;

namespace Miningcore.Crypto.Hashing.Algorithms;

[Identifier("groestl-myriad")]

Check failure on line 6 in src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'Identifier' attribute

Check failure on line 6 in src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs

View workflow job for this annotation

GitHub Actions / build

Duplicate 'Identifier' attribute
public unsafe class Kezzak : IHashAlgorithm
public unsafe class GroestlMyriad : IHashAlgorithm

Check failure on line 7 in src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs

View workflow job for this annotation

GitHub Actions / build

The namespace 'Miningcore.Crypto.Hashing.Algorithms' already contains a definition for 'GroestlMyriad'

Check failure on line 7 in src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs

View workflow job for this annotation

GitHub Actions / build

The namespace 'Miningcore.Crypto.Hashing.Algorithms' already contains a definition for 'GroestlMyriad'
{
public void Digest(ReadOnlySpan<byte> data, Span<byte> result, params object[] extra)

Check failure on line 9 in src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs

View workflow job for this annotation

GitHub Actions / build

Type 'GroestlMyriad' already defines a member called 'Digest' with the same parameter types

Check failure on line 9 in src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs

View workflow job for this annotation

GitHub Actions / build

Type 'GroestlMyriad' already defines a member called 'Digest' with the same parameter types
{
Contract.RequiresNonNull(extra);
Contract.Requires<ArgumentException>(extra.Length > 0);
Contract.Requires<ArgumentException>(result.Length >= 32);

// concat nTime as hex string to data
var nTime = (ulong) extra[0];
var nTimeHex = nTime.ToString("X").HexToByteArray();

Span<byte> dataEx = stackalloc byte[data.Length + nTimeHex.Length];
data.CopyTo(dataEx);

if(nTimeHex.Length > 0)
{
var dest = dataEx[data.Length..];
nTimeHex.CopyTo(dest);
}

fixed (byte* input = dataEx)
fixed (byte* input = data)
{
fixed (byte* output = result)
{
Multihash.kezzak(input, output, (uint) data.Length);
Multihash.groestl_myriad(input, output, (uint) data.Length);
}
}
}
Expand Down
Loading