EqualBytes() private static method

private static EqualBytes ( byte rgbKey, int start1, int start2, int count ) : bool
rgbKey byte
start1 int
start2 int
count int
return bool
コード例 #1
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: 0x060023CB RID: 9163 RVA: 0x000824C8 File Offset: 0x000806C8
 public static bool IsWeakKey(byte[] rgbKey)
 {
     if (!TripleDES.IsLegalKeySize(rgbKey))
     {
         throw new CryptographicException(Environment.GetResourceString("Cryptography_InvalidKeySize"));
     }
     byte[] array = Utils.FixupKeyParity(rgbKey);
     return(TripleDES.EqualBytes(array, 0, 8, 8) || (array.Length == 24 && TripleDES.EqualBytes(array, 8, 16, 8)));
 }