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

public Class Layer

extends Object
Class Inheritance
Imports
java.security.SecureRandom, org.bouncycastle.pqc.legacy.crypto.rainbow.util.GF2Field, .RainbowUtil, org.bouncycastle.util.Arrays

This class represents a layer of the Rainbow Oil- and Vinegar Map. Each Layer consists of oi polynomials with their coefficients, generated at random.

To sign a document, we solve a LES (linear equation system) for each layer in order to find the oil variables of that layer and to be able to use the variables to compute the signature. This functionality is implemented in the RainbowSignature-class, by the aid of the private key.

Each layer is a part of the private key.

More information about the layer can be found in the paper of Jintai Ding, Dieter Schmidt: Rainbow, a New Multivariable Polynomial Signature Scheme. ACNS 2005: 164-175 (https://dx.doi.org/10.1007/11496137_12)

Field Summary

Modifier and TypeField and Description
private short[][][]
private short[][][]
private short[]
private short[][]
private int
private int
private int

Constructor Summary

AccessConstructor and Description
public
Layer(byte
number of vinegar variables of this layer
vi
,
byte
number of vinegar variables of next layer. It's the same as (num of oils) + (num of vinegars) of this layer.
viNext
,
short[][][]
alpha-coefficients in the polynomials of this layer
coeffAlpha
,
short[][][]
beta-coefficients in the polynomials of this layer
coeffBeta
,
short[][]
gamma-coefficients in the polynomials of this layer
coeffGamma
,
short[]
eta-coefficients in the polynomials of this layer
coeffEta
)

Constructor

public
Layer(int vi, int viNext, SecureRandom
the random generator which is to be used
sr
)

This function generates the coefficients of all polynomials in this layer at random using random generator.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

the result of the comparison
equals
(Object
the other object
other
)

Overrides java.lang.Object.equals.

This function compares this Layer with another object.

public short[][][]

Returns:

the coefficients of alpha-terms of this layer.
getCoeffAlpha
()

Getter for the alpha-coefficients of the polynomials in this layer.

public short[][][]

Returns:

the coefficients of beta-terms of this layer.
getCoeffBeta
()

Getter for the beta-coefficients of the polynomials in this layer.

public short[]

Returns:

the coefficients eta of this layer
getCoeffEta
()

Getter for the eta-coefficients of the polynomials in this layer.

public short[][]

Returns:

the coefficients of gamma-terms of this layer
getCoeffGamma
()

Getter for the gamma-coefficients of the polynomials in this layer.

public int

Returns:

the number of oil variables of this layer.
getOi
()

Getter for the number of Oil variables of this layer.

public int

Returns:

the number of vinegar variables of this layer.
getVi
()

Getter for the number of vinegar variables of this layer.

public int

Returns:

the number of vinegar variables of the next layer.
getViNext
()

Getter for the number of vinegar variables of the next layer.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public short[][]

Returns:

coeff the coefficients of Oil variables and the free coeff in the polynomials of this layer.
plugInVinegars
(short[]
vinegar variables of this layer that should be plugged into the polynomials.
x
)

This method plugs in the vinegar variables into the polynomials of this layer and computes the coefficients of the Oil-variables as well as the free coefficient in each polynomial.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

coeff_alphaback to summary
private short[][][] coeff_alpha
coeff_betaback to summary
private short[][][] coeff_beta
coeff_etaback to summary
private short[] coeff_eta
coeff_gammaback to summary
private short[][] coeff_gamma
oiback to summary
private int oi
viback to summary
private int vi
viNextback to summary
private int viNext

Constructor Detail

Layerback to summary
public Layer(byte vi, byte viNext, short[][][] coeffAlpha, short[][][] coeffBeta, short[][] coeffGamma, short[] coeffEta)

Constructor

Parameters
vi:byte

number of vinegar variables of this layer

viNext:byte

number of vinegar variables of next layer. It's the same as (num of oils) + (num of vinegars) of this layer.

coeffAlpha:short[][][]

alpha-coefficients in the polynomials of this layer

coeffBeta:short[][][]

beta-coefficients in the polynomials of this layer

coeffGamma:short[][]

gamma-coefficients in the polynomials of this layer

coeffEta:short[]

eta-coefficients in the polynomials of this layer

Layerback to summary
public Layer(int vi, int viNext, SecureRandom sr)

This function generates the coefficients of all polynomials in this layer at random using random generator.

Parameters
sr:SecureRandom

the random generator which is to be used

Method Detail

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

This function compares this Layer with another object.

Parameters
other:Object

the other object

Returns:boolean

the result of the comparison

getCoeffAlphaback to summary
public short[][][] getCoeffAlpha()

Getter for the alpha-coefficients of the polynomials in this layer.

Returns:short[][][]

the coefficients of alpha-terms of this layer.

getCoeffBetaback to summary
public short[][][] getCoeffBeta()

Getter for the beta-coefficients of the polynomials in this layer.

Returns:short[][][]

the coefficients of beta-terms of this layer.

getCoeffEtaback to summary
public short[] getCoeffEta()

Getter for the eta-coefficients of the polynomials in this layer.

Returns:short[]

the coefficients eta of this layer

getCoeffGammaback to summary
public short[][] getCoeffGamma()

Getter for the gamma-coefficients of the polynomials in this layer.

Returns:short[][]

the coefficients of gamma-terms of this layer

getOiback to summary
public int getOi()

Getter for the number of Oil variables of this layer.

Returns:int

the number of oil variables of this layer.

getViback to summary
public int getVi()

Getter for the number of vinegar variables of this layer.

Returns:int

the number of vinegar variables of this layer.

getViNextback to summary
public int getViNext()

Getter for the number of vinegar variables of the next layer.

Returns:int

the number of vinegar variables of the next layer.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

plugInVinegarsback to summary
public short[][] plugInVinegars(short[] x)

This method plugs in the vinegar variables into the polynomials of this layer and computes the coefficients of the Oil-variables as well as the free coefficient in each polynomial.

It is needed for computing the Oil variables while signing.

Parameters
x:short[]

vinegar variables of this layer that should be plugged into the polynomials.

Returns:short[][]

coeff the coefficients of Oil variables and the free coeff in the polynomials of this layer.