예제 #1
0
        public override bool Verify(byte[] header, byte[] solution)
        {
            Contract.RequiresNonNull(header, nameof(header));
            Contract.Requires <ArgumentException>(header.Length == 180, $"{nameof(header)} must be exactly 180 bytes");
            Contract.RequiresNonNull(solution, nameof(solution));
            Contract.Requires <ArgumentException>(solution.Length == 100, $"{nameof(solution)} must be exactly 100 bytes");

            logger.LogInvoke();

            try
            {
                sem.Value.WaitOne();

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

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