Example #1
0
        /// <summary>
        /// Get the hash code for this object
        /// </summary>
        ///
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            int hash = Description.GetHashCode();

            hash += KeyId.GetHashCode();
            hash += ExtensionKey.GetHashCode();

            return(hash);
        }
Example #2
0
        /// <summary>
        /// Get the hash code for this object
        /// </summary>
        ///
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            int hash = 31 * 31 * Count;

            hash += Description.GetHashCode();
            hash += ArrayUtils.GetHashCode(Tag);
            hash += ArrayUtils.GetHashCode(FileId);
            hash += ArrayUtils.GetHashCode(State);

            return(hash);
        }
Example #3
0
        /// <summary>
        /// Get the hash code for this object
        /// </summary>
        ///
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            int hash = 31 * (int)KeyPolicy;

            hash += 31 * (int)CreatedOn;
            hash += 31 * SubKeyCount;
            hash += Authority.GetHashCode();
            hash += Description.GetHashCode();
            hash += ArrayUtils.GetHashCode(SubKeyPolicy);
            hash += ArrayUtils.GetHashCode(SubKeyID);

            return(hash);
        }
Example #4
0
        private void CipherDescriptionTest()
        {
            CipherDescription cd1 = new CipherDescription(
                SymmetricEngines.RHX,
                192, IVSizes.V128,
                CipherModes.CTR,
                PaddingModes.None,
                BlockSizes.B128,
                RoundCounts.R22);

            byte[]            bcd = cd1.ToBytes();
            CipherDescription cd2 = new CipherDescription(bcd);

            if (!cd1.Equals(cd2))
            {
                throw new Exception("KeyFactoryTest: CipherDescription serialization has failed!");
            }
            MemoryStream      mcd = cd2.ToStream();
            CipherDescription cd3 = new CipherDescription(mcd);

            if (!cd1.Equals(cd3))
            {
                throw new Exception("KeyFactoryTest: CipherDescription serialization has failed!");
            }

            int x = cd1.GetHashCode();

            if (x != cd2.GetHashCode() || x != cd3.GetHashCode())
            {
                throw new Exception("KeyFactoryTest: CipherDescription hash code test has failed!");
            }
        }