//http://www.bouncycastle.org/
//MIT X11 License
using System;
using System.Text;
namespace Org.BouncyCastle.Utilities
{
/// General array utilities.
public sealed class Arrays
{
private static bool HaveSameContents(byte[] a,byte[] b)
{
if (a.Length != b.Length)
return false;
for (int i = 0; i < a.Length; i++)
{
if (a[i] != b[i])
return false;
}
return true;
}
private static bool HaveSameContents(int[] a,int[] b)
{
if (a.Length != b.Length)
return false;
for (int i = 0; i < a.Length; i++)
{
if (a[i] != b[i])
return false;
}
return true;
}
///
/// Are two arrays equal.
///
/// Left side.
/// Right side.
/// True if equal.
public static bool AreEqual(byte[] a,byte[] b)
{
if (a == b)
return true;
if (a == null || b == null)
return false;
return HaveSameContents(a, b);
}
[Obsolete("Use 'AreEqual' method instead")]
public static bool AreSame(byte[] a,byte[] b)
{
return AreEqual(a, b);
}
public static bool AreEqual(int[] a,int[] b)
{
if (a == b)
return true;
if (a == null || b == null)
return false;
return HaveSameContents(a, b);
}
}
}