QuadWordFromBigEndian() 개인적인 정적인 메소드

private static QuadWordFromBigEndian ( byte block ) : UInt64
block byte
리턴 UInt64
예제 #1
0
파일: des.cs 프로젝트: wwkkww1983/ZJCredit
        /// <summary>确定指定的密钥是否为半弱密钥。</summary>
        /// <returns>如果该密钥为半弱密钥,则为 true;否则,为 false。</returns>
        /// <param name="rgbKey">要进行半弱漏洞测试的机密密钥。</param>
        /// <exception cref="T:System.Security.Cryptography.CryptographicException">
        /// <paramref name="rgbKey" /> 参数的大小无效。</exception>
        public static bool IsSemiWeakKey(byte[] rgbKey)
        {
            if (!DES.IsLegalKeySize(rgbKey))
            {
                throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
            }
            switch (DES.QuadWordFromBigEndian(Utils.FixupKeyParity(rgbKey)))
            {
            case 143554428589179390:
            case 18303189645120372225:
            case 2296870857142767345:
            case 16149873216566784270:
            case 135110050437988849:
            case 16141428838415593729:
            case 2305315235293957886:
            case 18311634023271562766:
            case 80784550989267214:
            case 2234100979542855169:
            case 16212643094166696446:
            case 18365959522720284401:
                return(true);

            default:
                return(false);
            }
        }
예제 #2
0
        /// <summary>Determines whether the specified key is weak.</summary>
        /// <param name="rgbKey">The secret key to test for weakness. </param>
        /// <returns>
        ///     <see langword="true" /> if the key is weak; otherwise, <see langword="false" />.</returns>
        /// <exception cref="T:System.Security.Cryptography.CryptographicException">The size of the <paramref name="rgbKey" /> parameter is not valid. </exception>
        // Token: 0x06002159 RID: 8537 RVA: 0x00075F30 File Offset: 0x00074130
        public static bool IsWeakKey(byte[] rgbKey)
        {
            if (!DES.IsLegalKeySize(rgbKey))
            {
                throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
            }
            byte[] block = Utils.FixupKeyParity(rgbKey);
            ulong  num   = DES.QuadWordFromBigEndian(block);

            return(num == 72340172838076673UL || num == 18374403900871474942UL || num == 2242545357694045710UL || num == 16204198716015505905UL);
        }
예제 #3
0
        /// <summary>Determines whether the specified key is semi-weak.</summary>
        /// <param name="rgbKey">The secret key to test for semi-weakness. </param>
        /// <returns>
        ///     <see langword="true" /> if the key is semi-weak; otherwise, <see langword="false" />.</returns>
        /// <exception cref="T:System.Security.Cryptography.CryptographicException">The size of the <paramref name="rgbKey" /> parameter is not valid. </exception>
        // Token: 0x0600215A RID: 8538 RVA: 0x00075F98 File Offset: 0x00074198
        public static bool IsSemiWeakKey(byte[] rgbKey)
        {
            if (!DES.IsLegalKeySize(rgbKey))
            {
                throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
            }
            byte[] block = Utils.FixupKeyParity(rgbKey);
            ulong  num   = DES.QuadWordFromBigEndian(block);

            return(num == 143554428589179390UL || num == 18303189645120372225UL || num == 2296870857142767345UL || num == 16149873216566784270UL || num == 135110050437988849UL || num == 16141428838415593729UL || num == 2305315235293957886UL || num == 18311634023271562766UL || num == 80784550989267214UL || num == 2234100979542855169UL || num == 16212643094166696446UL || num == 18365959522720284401UL);
        }
예제 #4
0
파일: des.cs 프로젝트: wwkkww1983/ZJCredit
        /// <summary>确定指定的密钥是否为弱密钥。</summary>
        /// <returns>如果该密钥为弱密钥,则为 true;否则,为 false。</returns>
        /// <param name="rgbKey">要进行漏洞测试的机密密钥。</param>
        /// <exception cref="T:System.Security.Cryptography.CryptographicException">
        /// <paramref name="rgbKey" /> 参数的大小无效。</exception>
        public static bool IsWeakKey(byte[] rgbKey)
        {
            if (!DES.IsLegalKeySize(rgbKey))
            {
                throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
            }
            switch (DES.QuadWordFromBigEndian(Utils.FixupKeyParity(rgbKey)))
            {
            case 72340172838076673:
            case 18374403900871474942:
            case 2242545357694045710:
            case 16204198716015505905:
                return(true);

            default:
                return(false);
            }
        }