public static bool BigEndianArraysAreEqual()

in TPM Parser/Tpm2Lib/Globs.cs [690:720]


        public static bool BigEndianArraysAreEqual(byte[] a1, byte[] a2)
        {
            int maxLen = Math.Min(a1.Length, a2.Length);
            for (int j = 0; j < maxLen; j++)
            {
                if (a1[a1.Length - 1 - j] != a2[a2.Length - 1 - j])
                {
                    return false;
                }
            }
            // Rest of the other array must be all zeros
            if (a1.Length > a2.Length)
            {
                for (int j = 0; j < a1.Length - a2.Length; j++)
                {
                    if (a1[j] != 0)
                    {
                        return false;
                    }
                }
            }
            if (a2.Length > a1.Length)
            {
                for (int j = 0; j < a2.Length - a1.Length; j++)
                {
                    if (a2[j] != 0)
                        return false;
                }
            }
            return true;
        }