private bool EqualsData(TcpOptionAuthentication other) { return(other != null && KeyId.Equals(other.KeyId) && RequestedNextKeyId.Equals(other.RequestedNextKeyId) && MessageAuthenticationCode.SequenceEqual(other.MessageAuthenticationCode)); }
/// <summary> /// Two DnsResourceDataTransactionSignature are equal iff their algorithm time signed, fudge, message authentication code, original ID, error /// and other fields are equal. /// </summary> public bool Equals(DnsResourceDataTransactionSignature other) { return(other != null && Algorithm.Equals(other.Algorithm) && TimeSigned.Equals(other.TimeSigned) && Fudge.Equals(other.Fudge) && MessageAuthenticationCode.Equals(other.MessageAuthenticationCode) && OriginalId.Equals(other.OriginalId) && Error.Equals(other.Error) && Other.Equals(other.Other)); }
/// <inheritdoc/> public override byte[] ToBytes() { int length = Data.Length + 11; byte[] result = new byte[length]; byte[] bytes; bytes = BitConverter.GetBytes(BitConverter.IsLittleEndian ? MessageAuthenticationCode.ChangeEndianness() : MessageAuthenticationCode); Array.Copy(bytes, 0, result, 0, bytes.Length); bytes = BitConverter.GetBytes(BitConverter.IsLittleEndian ? PacketId.ChangeEndianness() : PacketId); Array.Copy(bytes, 0, result, 8, bytes.Length); result[10] = (byte)((byte)Flags + (byte)Type); Array.Copy(Data, 0, result, 11, Data.Length); return(result); }
internal override int WriteData(byte[] buffer, int dnsOffset, int offsetInDns, DnsDomainNameCompressionData compressionData) { int algorithmLength = Algorithm.Write(buffer, dnsOffset, compressionData, offsetInDns); int offset = dnsOffset + offsetInDns + algorithmLength; buffer.Write(offset + OffsetAfterAlgorithm.TimeSigned, TimeSigned, Endianity.Big); buffer.Write(offset + OffsetAfterAlgorithm.Fudge, Fudge, Endianity.Big); buffer.Write(offset + OffsetAfterAlgorithm.MessageAuthenticationCodeSize, (ushort)MessageAuthenticationCode.Length, Endianity.Big); MessageAuthenticationCode.Write(buffer, offset + OffsetAfterAlgorithm.MessageAuthenticationCode); offset += OffsetAfterAlgorithm.MessageAuthenticationCode + MessageAuthenticationCode.Length; buffer.Write(offset + OffsetAfterMessageAuthenticationCode.OriginalId, OriginalId, Endianity.Big); buffer.Write(offset + OffsetAfterMessageAuthenticationCode.Error, (ushort)Error, Endianity.Big); buffer.Write(offset + OffsetAfterMessageAuthenticationCode.OtherLength, (ushort)Other.Length, Endianity.Big); Other.Write(buffer, offset + OffsetAfterMessageAuthenticationCode.OtherData); return(algorithmLength + ConstantPartLength + MessageAuthenticationCode.Length + Other.Length); }
internal override int GetDataHashCode() { return(MessageAuthenticationCode.Concat(KeyId, RequestedNextKeyId).BytesSequenceGetHashCode()); }