Example #1
0
 /// <summary>
 /// Two DnsResourceDataDelegationSigner are equal iff their key tag, algorithm, digest type and digest fields are equal.
 /// </summary>
 public bool Equals(DnsResourceDataDelegationSigner other)
 {
     return(other != null &&
            KeyTag.Equals(other.KeyTag) &&
            Algorithm.Equals(other.Algorithm) &&
            DigestType.Equals(other.DigestType) &&
            Digest.Equals(other.Digest));
 }
Example #2
0
        internal bool JSONEquals(Dictionary <string, object> obj)
        {
            if ((obj.ContainsKey(DigestKey) & Digest.Equals(obj[DigestKey])) &&
                (obj.ContainsKey(LengthKey) & Length == (Int64)obj[LengthKey]) &&
                (obj.ContainsKey(ContentTypeKey) & ContentType.Equals(obj[ContentTypeKey])) &&
                (obj.ContainsKey(Constants.ObjectTypeProperty) & Type.Equals(obj[Constants.ObjectTypeProperty])))
            {
                return(true);
            }

            return(false);
        }
Example #3
0
        /// <summary>
        /// Determines whether the specified object is equal to the current object.
        /// </summary>
        /// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
        /// <param name="obj">The object to compare with the current object. </param>
#pragma warning disable 659
        public override bool Equals(object obj)
#pragma warning restore 659
        {
            if (obj is Blob other)
            {
                if (Digest != null && other.Digest != null)
                {
                    return(Digest.Equals(other.Digest));
                }

                if (Length != other.Length)
                {
                    return(false);
                }

                using (var stream1 = ContentStream)
                    using (var stream2 = other.ContentStream) {
                        if (stream1 == null)
                        {
                            return(stream2 == null);
                        }

                        if (stream2 == null)
                        {
                            return(false);
                        }

                        int next1;
                        while ((next1 = stream1.ReadByte()) != -1)
                        {
                            var next2 = stream2.ReadByte();
                            if (next1 != next2)
                            {
                                return(false);
                            }
                        }

                        return(true);
                    }
            }

            return(false);
        }
Example #4
0
        /// <summary>
        /// Compare this object instance with another
        /// </summary>
        ///
        /// <param name="Obj">Object to compare</param>
        ///
        /// <returns>True if equal, otherwise false</returns>
        public override bool Equals(Object Obj)
        {
            if (this == Obj)
            {
                return(true);
            }
            if (Obj == null)
            {
                return(false);
            }

            NTRUParameters other = (NTRUParameters)Obj;

            if (N != other.N)
            {
                return(false);
            }
            if (BufferLenBits != other.BufferLenBits)
            {
                return(false);
            }
            if (_bufferLenTrits != other._bufferLenTrits)
            {
                return(false);
            }
            if (CBits != other.CBits)
            {
                return(false);
            }
            if (Db != other.Db)
            {
                return(false);
            }
            if (DF != other.DF)
            {
                return(false);
            }
            if (DF1 != other.DF1)
            {
                return(false);
            }
            if (DF2 != other.DF2)
            {
                return(false);
            }
            if (DF3 != other.DF3)
            {
                return(false);
            }
            if (Dg != other.Dg)
            {
                return(false);
            }
            if (Dm0 != other.Dm0)
            {
                return(false);
            }
            if (MaxM1 != other.MaxM1)
            {
                return(false);
            }
            if (DR != other.DR)
            {
                return(false);
            }
            if (DR1 != other.DR1)
            {
                return(false);
            }
            if (DR2 != other.DR2)
            {
                return(false);
            }
            if (DR3 != other.DR3)
            {
                return(false);
            }
            if (FastFp != other.FastFp)
            {
                return(false);
            }
            if (!Digest.Equals(other.Digest))
            {
                return(false);
            }
            if (!RandomEngine.Equals(other.RandomEngine))
            {
                return(false);
            }
            if (HashSeed != other.HashSeed)
            {
                return(false);
            }
            if (Length != other.Length)
            {
                return(false);
            }
            if (MessageMax != other.MessageMax)
            {
                return(false);
            }
            if (MinMGFHashCalls != other.MinMGFHashCalls)
            {
                return(false);
            }
            if (MinIGFHashCalls != other.MinIGFHashCalls)
            {
                return(false);
            }
            if (!Compare.AreEqual(OId, other.OId))
            {
                return(false);
            }
            if (PkLen != other.PkLen)
            {
                return(false);
            }
            if (!PolyType.Equals(other.PolyType))
            {
                return(false);
            }
            if (Q != other.Q)
            {
                return(false);
            }
            if (Sparse != other.Sparse)
            {
                return(false);
            }

            return(true);
        }