Beispiel #1
0
        public override bool Verify(ReadOnlySpan <byte> header, ReadOnlySpan <byte> solution)
        {
            var sw = Stopwatch.StartNew();

            try
            {
                sem.Value.WaitOne();

                fixed(byte *h = header)
                {
                    fixed(byte *s = solution)
                    {
                        var result = LibMultihash.equihash_verify_200_9(h, header.Length, s, solution.Length, personalization);

                        messageBus?.SendTelemetry("Equihash 200-9", TelemetryCategory.Hash, sw.Elapsed, result);

                        return(result);
                    }
                }
            }

            finally
            {
                sem.Value.Release();
            }
        }
        public override bool Verify(byte[] header, byte[] solution)
        {
            Contract.RequiresNonNull(header, nameof(header));
            Contract.Requires <ArgumentException>(header.Length == 140, $"{nameof(header)} must be exactly 140 bytes");
            Contract.RequiresNonNull(solution, nameof(solution));
            Contract.Requires <ArgumentException>(solution.Length == 1344, $"{nameof(solution)} must be exactly 1344 bytes");

            logger.LogInvoke();

            try
            {
                sem.Value.WaitOne();

                fixed(byte *h = header)
                {
                    fixed(byte *s = solution)
                    {
                        return(LibMultihash.equihash_verify_200_9(h, header.Length, s, solution.Length, personalization));
                    }
                }
            }

            finally
            {
                sem.Value.Release();
            }
        }
Beispiel #3
0
        public override bool Verify(ReadOnlySpan <byte> header, ReadOnlySpan <byte> solution)
        {
            try
            {
                sem.Value.WaitOne();

                fixed(byte *h = header)
                {
                    fixed(byte *s = solution)
                    {
                        return(LibMultihash.equihash_verify_200_9(h, header.Length, s, solution.Length, personalization));
                    }
                }
            }

            finally
            {
                sem.Value.Release();
            }
        }