Skip to content

Commit

Permalink
Update Kezzak.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
lurchinms authored Oct 12, 2024
1 parent a108897 commit f1457b8
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/Miningcore/Crypto/Hashing/Algorithms/Kezzak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,14 @@

namespace Miningcore.Crypto.Hashing.Algorithms;

[Identifier("groestl-myriad")]
[Identifier("keccakc")]
public unsafe class Kezzak : IHashAlgorithm
{
public void Digest(ReadOnlySpan<byte> data, Span<byte> result, params object[] extra)
{
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)
{
Expand Down

0 comments on commit f1457b8

Please sign in to comment.