using Mirea.Api.Endpoint.Common.Interfaces; using System; namespace Mirea.Api.Endpoint.Configuration.General; public class SetupTokenService : ISetupToken { public ReadOnlyMemory? Token { get; private set; } public bool MatchToken(ReadOnlySpan token) { if (Token == null || token.Length != Token.Value.Length) return false; var token2 = Token.Value.Span; int result = 0; for (int i = 0; i < Token.Value.Length; i++) result |= token2[i] ^ token[i]; return result == 0; } public void SetToken(ReadOnlySpan token) { Token = token.ToArray(); } }