Top Description Fields Constructors Methods
org.bouncycastle.pqc.legacy.crypto.mceliece

pack-priv final Class Conversions

extends Object
Class Inheritance
Imports
java.math.BigInteger, org.bouncycastle.pqc.legacy.math.linearalgebra.BigIntUtils, .GF2Vector, .IntegerFunctions

Provides methods for CCA2-Secure Conversions of McEliece PKCS

Field Summary

Modifier and TypeField and Description
private static final BigInteger
private static final BigInteger

Constructor Summary

AccessConstructor and Description
private
Conversions()

Default constructor (private).

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

the decoded vector as a byte array
decode
(int
integer
n
,
int
integer
t
,
GF2Vector
the binary vector
vec
)

Decode a binary vector of length n and weight t into a number between 0 and (n|t) (binomial coefficient).

public static GF2Vector

Returns:

the encoded message as GF2Vector
encode
(final int
integer
n
,
final int
integer
t
,
final byte[]
the message as a byte array
m
)

Encode a number between 0 and (n|t) (binomial coefficient) into a binary vector of length n with weight t.

public static byte[]

Returns:

a message representative for m
signConversion
(int
integer
n
,
int
integer
t
,
byte[]
the message vector as a byte array
m
)

Compute a message representative of a message given as a vector of length n bit and of hamming weight t.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ONEback to summary
private static final BigInteger ONE
ZEROback to summary
private static final BigInteger ZERO

Constructor Detail

Conversionsback to summary
private Conversions()

Default constructor (private).

Method Detail

decodeback to summary
public static byte[] decode(int n, int t, GF2Vector vec)

Decode a binary vector of length n and weight t into a number between 0 and (n|t) (binomial coefficient). The result is given as a byte array of length floor[(s+7)/8], where s = floor[log(n|t)].

Parameters
n:int

integer

t:int

integer

vec:GF2Vector

the binary vector

Returns:byte[]

the decoded vector as a byte array

encodeback to summary
public static GF2Vector encode(final int n, final int t, final byte[] m)

Encode a number between 0 and (n|t) (binomial coefficient) into a binary vector of length n with weight t. The number is given as a byte array. Only the first s bits are used, where s = floor[log(n|t)].

Parameters
n:int

integer

t:int

integer

m:byte[]

the message as a byte array

Returns:GF2Vector

the encoded message as GF2Vector

signConversionback to summary
public static byte[] signConversion(int n, int t, byte[] m)

Compute a message representative of a message given as a vector of length n bit and of hamming weight t. The result is a byte array of length (s+7)/8, where s = floor[log(n|t)].

Parameters
n:int

integer

t:int

integer

m:byte[]

the message vector as a byte array

Returns:byte[]

a message representative for m