Table of Contents

Class Arrays

Namespace
Org.BouncyCastle.Utilities
Assembly
BouncyCastle.Cryptography.dll

General array utilities.

public static class Arrays
Inheritance
Arrays
Inherited Members

Fields

EmptyBytes

public static readonly byte[] EmptyBytes

Field Value

byte[]

EmptyInts

public static readonly int[] EmptyInts

Field Value

int[]

Methods

Append(byte[], byte)

public static byte[] Append(byte[] a, byte b)

Parameters

a byte[]
b byte

Returns

byte[]

Append(short[], short)

public static short[] Append(short[] a, short b)

Parameters

a short[]
b short

Returns

short[]

Append(int[], int)

public static int[] Append(int[] a, int b)

Parameters

a int[]
b int

Returns

int[]

AreAllZeroes(byte[], int, int)

public static bool AreAllZeroes(byte[] buf, int off, int len)

Parameters

buf byte[]
off int
len int

Returns

bool

AreAllZeroes(ReadOnlySpan<byte>)

public static bool AreAllZeroes(ReadOnlySpan<byte> buf)

Parameters

buf ReadOnlySpan<byte>

Returns

bool

AreEqual(bool[], bool[])

public static bool AreEqual(bool[] a, bool[] b)

Parameters

a bool[]
b bool[]

Returns

bool

AreEqual(byte[], byte[])

Are two arrays equal.

public static bool AreEqual(byte[] a, byte[] b)

Parameters

a byte[]

Left side.

b byte[]

Right side.

Returns

bool

True if equal.

AreEqual(byte[], int, int, byte[], int, int)

public static bool AreEqual(byte[] a, int aFromIndex, int aToIndex, byte[] b, int bFromIndex, int bToIndex)

Parameters

a byte[]
aFromIndex int
aToIndex int
b byte[]
bFromIndex int
bToIndex int

Returns

bool

AreEqual(char[], char[])

public static bool AreEqual(char[] a, char[] b)

Parameters

a char[]
b char[]

Returns

bool

AreEqual(int[], int[])

public static bool AreEqual(int[] a, int[] b)

Parameters

a int[]
b int[]

Returns

bool

AreEqual(long[], long[])

public static bool AreEqual(long[] a, long[] b)

Parameters

a long[]
b long[]

Returns

bool

AreEqual(object[], int, int, object[], int, int)

public static bool AreEqual(object[] a, int aFromIndex, int aToIndex, object[] b, int bFromIndex, int bToIndex)

Parameters

a object[]
aFromIndex int
aToIndex int
b object[]
bFromIndex int
bToIndex int

Returns

bool

AreEqual(object[], object[])

public static bool AreEqual(object[] a, object[] b)

Parameters

a object[]
b object[]

Returns

bool

AreEqual(uint[], uint[])

[CLSCompliant(false)]
public static bool AreEqual(uint[] a, uint[] b)

Parameters

a uint[]
b uint[]

Returns

bool

AreEqual(ulong[], int, int, ulong[], int, int)

[CLSCompliant(false)]
public static bool AreEqual(ulong[] a, int aFromIndex, int aToIndex, ulong[] b, int bFromIndex, int bToIndex)

Parameters

a ulong[]
aFromIndex int
aToIndex int
b ulong[]
bFromIndex int
bToIndex int

Returns

bool

AreEqual(ulong[], ulong[])

[CLSCompliant(false)]
public static bool AreEqual(ulong[] a, ulong[] b)

Parameters

a ulong[]
b ulong[]

Returns

bool

Clear(byte[])

public static void Clear(byte[] data)

Parameters

data byte[]

Clear(int[])

public static void Clear(int[] data)

Parameters

data int[]

Clone(bool[])

public static bool[] Clone(bool[] data)

Parameters

data bool[]

Returns

bool[]

Clone(byte[])

public static byte[] Clone(byte[] data)

Parameters

data byte[]

Returns

byte[]

Clone(byte[], byte[])

public static byte[] Clone(byte[] data, byte[] existing)

Parameters

data byte[]
existing byte[]

Returns

byte[]

Clone(short[])

public static short[] Clone(short[] data)

Parameters

data short[]

Returns

short[]

Clone(int[])

public static int[] Clone(int[] data)

Parameters

data int[]

Returns

int[]

Clone(long[])

public static long[] Clone(long[] data)

Parameters

data long[]

Returns

long[]

Clone(ushort[])

[CLSCompliant(false)]
public static ushort[] Clone(ushort[] data)

Parameters

data ushort[]

Returns

ushort[]

Clone(uint[])

[CLSCompliant(false)]
public static uint[] Clone(uint[] data)

Parameters

data uint[]

Returns

uint[]

Clone(ulong[])

[CLSCompliant(false)]
public static ulong[] Clone(ulong[] data)

Parameters

data ulong[]

Returns

ulong[]

Clone(ulong[], ulong[])

[CLSCompliant(false)]
public static ulong[] Clone(ulong[] data, ulong[] existing)

Parameters

data ulong[]
existing ulong[]

Returns

ulong[]

Concatenate(byte[], byte[])

public static byte[] Concatenate(byte[] a, byte[] b)

Parameters

a byte[]
b byte[]

Returns

byte[]

Concatenate(int[], int[])

public static int[] Concatenate(int[] a, int[] b)

Parameters

a int[]
b int[]

Returns

int[]

Concatenate(ReadOnlySpan<byte>, ReadOnlySpan<byte>)

public static byte[] Concatenate(ReadOnlySpan<byte> a, ReadOnlySpan<byte> b)

Parameters

a ReadOnlySpan<byte>
b ReadOnlySpan<byte>

Returns

byte[]

Concatenate(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)

public static byte[] Concatenate(ReadOnlySpan<byte> a, ReadOnlySpan<byte> b, ReadOnlySpan<byte> c)

Parameters

a ReadOnlySpan<byte>
b ReadOnlySpan<byte>
c ReadOnlySpan<byte>

Returns

byte[]

Concatenate(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)

public static byte[] Concatenate(ReadOnlySpan<byte> a, ReadOnlySpan<byte> b, ReadOnlySpan<byte> c, ReadOnlySpan<byte> d)

Parameters

a ReadOnlySpan<byte>
b ReadOnlySpan<byte>
c ReadOnlySpan<byte>
d ReadOnlySpan<byte>

Returns

byte[]

Concatenate(ushort[], ushort[])

[CLSCompliant(false)]
public static ushort[] Concatenate(ushort[] a, ushort[] b)

Parameters

a ushort[]
b ushort[]

Returns

ushort[]

Concatenate(uint[], uint[])

[CLSCompliant(false)]
public static uint[] Concatenate(uint[] a, uint[] b)

Parameters

a uint[]
b uint[]

Returns

uint[]

ConcatenateAll(params byte[][])

public static byte[] ConcatenateAll(params byte[][] vs)

Parameters

vs byte[][]

Returns

byte[]

ConstantTimeAreEqual(byte[], byte[])

[Obsolete("Use 'FixedTimeEquals' instead")]
public static bool ConstantTimeAreEqual(byte[] a, byte[] b)

Parameters

a byte[]
b byte[]

Returns

bool

ConstantTimeAreEqual(int, byte[], int, byte[], int)

[Obsolete("Use 'FixedTimeEquals' instead")]
public static bool ConstantTimeAreEqual(int len, byte[] a, int aOff, byte[] b, int bOff)

Parameters

len int
a byte[]
aOff int
b byte[]
bOff int

Returns

bool

ConstantTimeAreEqual(Span<byte>, Span<byte>)

[Obsolete("Use 'FixedTimeEquals' instead")]
public static bool ConstantTimeAreEqual(Span<byte> a, Span<byte> b)

Parameters

a Span<byte>
b Span<byte>

Returns

bool

Contains(byte[], byte)

public static bool Contains(byte[] a, byte n)

Parameters

a byte[]
n byte

Returns

bool

Contains(short[], short)

public static bool Contains(short[] a, short n)

Parameters

a short[]
n short

Returns

bool

Contains(int[], int)

public static bool Contains(int[] a, int n)

Parameters

a int[]
n int

Returns

bool

CopyOf(BigInteger[], int)

public static BigInteger[] CopyOf(BigInteger[] data, int newLength)

Parameters

data BigInteger[]
newLength int

Returns

BigInteger[]

CopyOf(byte[], int)

public static byte[] CopyOf(byte[] data, int newLength)

Parameters

data byte[]
newLength int

Returns

byte[]

CopyOf(char[], int)

public static char[] CopyOf(char[] data, int newLength)

Parameters

data char[]
newLength int

Returns

char[]

CopyOf(int[], int)

public static int[] CopyOf(int[] data, int newLength)

Parameters

data int[]
newLength int

Returns

int[]

CopyOf(long[], int)

public static long[] CopyOf(long[] data, int newLength)

Parameters

data long[]
newLength int

Returns

long[]

CopyOf(uint[], int)

[CLSCompliant(false)]
public static uint[] CopyOf(uint[] data, int newLength)

Parameters

data uint[]
newLength int

Returns

uint[]

CopyOfRange(BigInteger[], int, int)

public static BigInteger[] CopyOfRange(BigInteger[] data, int from, int to)

Parameters

data BigInteger[]
from int
to int

Returns

BigInteger[]

CopyOfRange(byte[], int, int)

public static byte[] CopyOfRange(byte[] data, int from, int to)

Parameters

data byte[]
from int
to int

Returns

byte[]

CopyOfRange(int[], int, int)

public static int[] CopyOfRange(int[] data, int from, int to)

Parameters

data int[]
from int
to int

Returns

int[]

CopyOfRange(long[], int, int)

public static long[] CopyOfRange(long[] data, int from, int to)

Parameters

data long[]
from int
to int

Returns

long[]

Fill(byte[], byte)

public static void Fill(byte[] buf, byte b)

Parameters

buf byte[]
b byte

Fill(byte[], int, int, byte)

public static void Fill(byte[] buf, int from, int to, byte b)

Parameters

buf byte[]
from int
to int
b byte

Fill(ulong[], ulong)

[CLSCompliant(false)]
public static void Fill(ulong[] buf, ulong b)

Parameters

buf ulong[]
b ulong

Fill<T>(Span<T>, T)

public static void Fill<T>(Span<T> ts, T t)

Parameters

ts Span<T>
t T

Type Parameters

T

Fill<T>(T[], int, int, T)

public static void Fill<T>(T[] ts, int from, int to, T t)

Parameters

ts T[]
from int
to int
t T

Type Parameters

T

Fill<T>(T[], T)

public static void Fill<T>(T[] ts, T t)

Parameters

ts T[]
t T

Type Parameters

T

FixedTimeEquals(byte[], byte[])

public static bool FixedTimeEquals(byte[] a, byte[] b)

Parameters

a byte[]
b byte[]

Returns

bool

FixedTimeEquals(int, byte[], int, byte[], int)

public static bool FixedTimeEquals(int len, byte[] a, int aOff, byte[] b, int bOff)

Parameters

len int
a byte[]
aOff int
b byte[]
bOff int

Returns

bool

FixedTimeEquals(ReadOnlySpan<byte>, ReadOnlySpan<byte>)

public static bool FixedTimeEquals(ReadOnlySpan<byte> a, ReadOnlySpan<byte> b)

Parameters

a ReadOnlySpan<byte>
b ReadOnlySpan<byte>

Returns

bool

GetHashCode(byte[])

public static int GetHashCode(byte[] data)

Parameters

data byte[]

Returns

int

GetHashCode(byte[], int, int)

public static int GetHashCode(byte[] data, int off, int len)

Parameters

data byte[]
off int
len int

Returns

int

GetHashCode(int[])

public static int GetHashCode(int[] data)

Parameters

data int[]

Returns

int

GetHashCode(int[], int, int)

public static int GetHashCode(int[] data, int off, int len)

Parameters

data int[]
off int
len int

Returns

int

GetHashCode(object[])

public static int GetHashCode(object[] data)

Parameters

data object[]

Returns

int

GetHashCode(object[], int, int)

public static int GetHashCode(object[] data, int off, int len)

Parameters

data object[]
off int
len int

Returns

int

GetHashCode(ushort[])

[CLSCompliant(false)]
public static int GetHashCode(ushort[] data)

Parameters

data ushort[]

Returns

int

GetHashCode(uint[])

[CLSCompliant(false)]
public static int GetHashCode(uint[] data)

Parameters

data uint[]

Returns

int

GetHashCode(uint[], int, int)

[CLSCompliant(false)]
public static int GetHashCode(uint[] data, int off, int len)

Parameters

data uint[]
off int
len int

Returns

int

GetHashCode(ulong[])

[CLSCompliant(false)]
public static int GetHashCode(ulong[] data)

Parameters

data ulong[]

Returns

int

GetHashCode(ulong[], int, int)

[CLSCompliant(false)]
public static int GetHashCode(ulong[] data, int off, int len)

Parameters

data ulong[]
off int
len int

Returns

int

IsNullOrContainsNull(object[])

public static bool IsNullOrContainsNull(object[] array)

Parameters

array object[]

Returns

bool

IsNullOrEmpty(byte[])

public static bool IsNullOrEmpty(byte[] array)

Parameters

array byte[]

Returns

bool

IsNullOrEmpty(object[])

public static bool IsNullOrEmpty(object[] array)

Parameters

array object[]

Returns

bool

Prepend(byte[], byte)

public static byte[] Prepend(byte[] a, byte b)

Parameters

a byte[]
b byte

Returns

byte[]

Prepend(short[], short)

public static short[] Prepend(short[] a, short b)

Parameters

a short[]
b short

Returns

short[]

Prepend(int[], int)

public static int[] Prepend(int[] a, int b)

Parameters

a int[]
b int

Returns

int[]

Prepend<T>(ReadOnlySpan<T>, T)

public static T[] Prepend<T>(ReadOnlySpan<T> a, T b)

Parameters

a ReadOnlySpan<T>
b T

Returns

T[]

Type Parameters

T

Prepend<T>(T[], T)

public static T[] Prepend<T>(T[] a, T b)

Parameters

a T[]
b T

Returns

T[]

Type Parameters

T

Reverse(byte[])

public static byte[] Reverse(byte[] a)

Parameters

a byte[]

Returns

byte[]

Reverse(int[])

public static int[] Reverse(int[] a)

Parameters

a int[]

Returns

int[]

ReverseInPlace<T>(T[])

public static T[] ReverseInPlace<T>(T[] array)

Parameters

array T[]

Returns

T[]

Type Parameters

T

ToString(object[])

public static string ToString(object[] a)

Parameters

a object[]

Returns

string

ValidateBuffer<T>(T[])

public static void ValidateBuffer<T>(T[] buf)

Parameters

buf T[]

Type Parameters

T

ValidateRange<T>(T[], int, int)

public static void ValidateRange<T>(T[] buf, int from, int to)

Parameters

buf T[]
from int
to int

Type Parameters

T

ValidateSegment<T>(T[], int, int)

public static void ValidateSegment<T>(T[] buf, int off, int len)

Parameters

buf T[]
off int
len int

Type Parameters

T