Top Description Constructors Methods
org.bouncycastle.pqc.legacy.math.linearalgebra

public final Class LittleEndianConversions

extends Object
Class Inheritance

This is a utility class containing data type conversions using little-endian byte order.
See Also
BigEndianConversions

Constructor Summary

AccessConstructor and Description
private
LittleEndianConversions()

Default constructor (private).

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

the converted integer
I2OSP
(int
the integer to convert
x
)

Convert an integer to an octet string of length 4.

public static void
I2OSP(int
the integer to convert
value
,
byte[]
the byte array to hold the result
output
,
int
the integer offset into the byte array
outOff
)

Convert an integer into a byte array beginning at the specified offset.

public static void
I2OSP(int
the integer to convert
value
,
byte[]
the byte array to hold the result
output
,
int
the integer offset into the byte array
outOff
,
int
the length of the encoding
outLen
)

Convert an integer to a byte array beginning at the specified offset.

public static byte[]

Returns:

the converted integer
I2OSP
(long
the integer to convert
input
)

Convert an integer to a byte array of length 8.

public static void
I2OSP(long
the integer to convert
input
,
byte[]
byte array holding the output
output
,
int
offset in output array where the result is stored
outOff
)

Convert an integer to a byte array of length 8.

public static int

Returns:

an integer representing the octet string input
OS2IP
(byte[]
the byte array holding the octet string
input
)

Convert an octet string of length 4 to an integer.

public static int

Returns:

the resulting integer
OS2IP
(byte[]
the byte array
input
,
int
the offset into the byte array
inOff
)

Convert an byte array of length 4 beginning at offset into an integer.

public static int

Returns:

the resulting integer
OS2IP
(byte[]
the byte array
input
,
int
the offset into the byte array
inOff
,
int
the length of the encoding
inLen
)

Convert a byte array of the given length beginning at offset into an integer.

public static long

Returns:

the resulting long integer
OS2LIP
(byte[]
the byte array
input
,
int
the offset into the byte array
inOff
)

Convert a byte array of length 8 beginning at inOff into a long integer.

public static byte[]

Returns:

the converted array
toByteArray
(int[]
the int array
input
,
int
the length of the converted array
outLen
)

Convert an int array to a byte array of the specified length.

public static int[]

Returns:

the converted array
toIntArray
(byte[]
the byte array
input
)

Convert a byte array to an int array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

LittleEndianConversionsback to summary
private LittleEndianConversions()

Default constructor (private).

Method Detail

I2OSPback to summary
public static byte[] I2OSP(int x)

Convert an integer to an octet string of length 4.

Parameters
x:int

the integer to convert

Returns:byte[]

the converted integer

I2OSPback to summary
public static void I2OSP(int value, byte[] output, int outOff)

Convert an integer into a byte array beginning at the specified offset.

Parameters
value:int

the integer to convert

output:byte[]

the byte array to hold the result

outOff:int

the integer offset into the byte array

I2OSPback to summary
public static void I2OSP(int value, byte[] output, int outOff, int outLen)

Convert an integer to a byte array beginning at the specified offset. No length checking is performed (i.e., if the integer cannot be encoded with length octets, it is truncated).

Parameters
value:int

the integer to convert

output:byte[]

the byte array to hold the result

outOff:int

the integer offset into the byte array

outLen:int

the length of the encoding

I2OSPback to summary
public static byte[] I2OSP(long input)

Convert an integer to a byte array of length 8.

Parameters
input:long

the integer to convert

Returns:byte[]

the converted integer

I2OSPback to summary
public static void I2OSP(long input, byte[] output, int outOff)

Convert an integer to a byte array of length 8.

Parameters
input:long

the integer to convert

output:byte[]

byte array holding the output

outOff:int

offset in output array where the result is stored

OS2IPback to summary
public static int OS2IP(byte[] input)

Convert an octet string of length 4 to an integer. No length checking is performed.

Parameters
input:byte[]

the byte array holding the octet string

Returns:int

an integer representing the octet string input

Exceptions
ArithmeticException:
if the length of the given octet string is larger than 4.
OS2IPback to summary
public static int OS2IP(byte[] input, int inOff)

Convert an byte array of length 4 beginning at offset into an integer.

Parameters
input:byte[]

the byte array

inOff:int

the offset into the byte array

Returns:int

the resulting integer

OS2IPback to summary
public static int OS2IP(byte[] input, int inOff, int inLen)

Convert a byte array of the given length beginning at offset into an integer.

Parameters
input:byte[]

the byte array

inOff:int

the offset into the byte array

inLen:int

the length of the encoding

Returns:int

the resulting integer

OS2LIPback to summary
public static long OS2LIP(byte[] input, int inOff)

Convert a byte array of length 8 beginning at inOff into a long integer.

Parameters
input:byte[]

the byte array

inOff:int

the offset into the byte array

Returns:long

the resulting long integer

toByteArrayback to summary
public static byte[] toByteArray(int[] input, int outLen)

Convert an int array to a byte array of the specified length. No length checking is performed (i.e., if the last integer cannot be encoded with length % 4 octets, it is truncated).

Parameters
input:int[]

the int array

outLen:int

the length of the converted array

Returns:byte[]

the converted array

toIntArrayback to summary
public static int[] toIntArray(byte[] input)

Convert a byte array to an int array.

Parameters
input:byte[]

the byte array

Returns:int[]

the converted array