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_144_5(h, header.Length, s, solution.Length, personalization); messageBus?.SendTelemetry(personalization ?? "Equihash 144-5", 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 == 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_144_5(h, header.Length, s, solution.Length, personalization)); } } } finally { sem.Value.Release(); } }
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_144_5(h, header.Length, s, solution.Length, personalization)); } } } finally { sem.Value.Release(); } }