Top Description Inners Fields Constructors Methods
org.bouncycastle.pqc.legacy.crypto.ntru

public Class IndexGenerator

extends Object
Class Inheritance
Imports
org.bouncycastle.crypto.Digest, org.bouncycastle.util.Arrays

An implementation of the Index Generation Function in IEEE P1363.1.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
IndexGenerator.BitString

Represents a string of bits and supports appending, reading the head, and reading the tail.

Field Summary

Modifier and TypeField and Description
private IndexGenerator.BitString
private int
c

private int
private Digest
private int
private boolean
private int
private int
N

private int
private byte[]
private int

Constructor Summary

AccessConstructor and Description
pack-priv
IndexGenerator(byte[]
a seed of arbitrary length to initialize the index generator with
seed
,
NTRUEncryptionParameters
NtruEncrypt parameters
params
)

Constructs a new index generator.

Method Summary

Modifier and TypeMethod and Description
private void
private static byte[]
copyOf(byte[] src, int len)

pack-priv int
private void
putInt(Digest hashAlg, int counter)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufback to summary
private IndexGenerator.BitString buf
cback to summary
private int c
counterback to summary
private int counter
hashAlgback to summary
private Digest hashAlg
hLenback to summary
private int hLen
initializedback to summary
private boolean initialized
minCallsRback to summary
private int minCallsR
Nback to summary
private int N
remLenback to summary
private int remLen
seedback to summary
private byte[] seed
totLenback to summary
private int totLen

Constructor Detail

IndexGeneratorback to summary
pack-priv IndexGenerator(byte[] seed, NTRUEncryptionParameters params)

Constructs a new index generator.

Parameters
seed:byte[]

a seed of arbitrary length to initialize the index generator with

params:NTRUEncryptionParameters

NtruEncrypt parameters

Method Detail

appendHashback to summary
private void appendHash(IndexGenerator.BitString m, byte[] hash)
copyOfback to summary
private static byte[] copyOf(byte[] src, int len)
nextIndexback to summary
pack-priv int nextIndex()
putIntback to summary
private void putInt(Digest hashAlg, int counter)
org.bouncycastle.pqc.legacy.crypto.ntru back to summary

public Class IndexGenerator.BitString

extends Object
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.pqc.legacy.crypto.ntru.IndexGenerator.BitString

Represents a string of bits and supports appending, reading the head, and reading the tail.

Field Summary

Modifier and TypeField and Description
pack-priv byte[]
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
appendBits(byte[]
a byte array
bytes
)

Appends all bits in a byte array to the end of the bit string.

public void
appendBits(byte
a byte
b
)

Appends all bits in a byte to the end of the bit string.

public byte[]
public int

Returns:

an int whose lower numBits bits are the beginning of the bit string
getLeadingAsInt
(int
number of bits
numBits
)

Returns up to 32 bits from the beginning of the bit string.

public IndexGenerator.BitString

Returns:

a new BitString of length numBits
getTrailing
(int
number of bits
numBits
)

Returns the last numBits bits from the end of the bit string.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bytesback to summary
pack-priv byte[] bytes
lastByteBitsback to summary
pack-priv int lastByteBits
numBytesback to summary
pack-priv int numBytes

Constructor Detail

BitStringback to summary
public BitString()

Method Detail

appendBitsback to summary
pack-priv void appendBits(byte[] bytes)

Appends all bits in a byte array to the end of the bit string.

Parameters
bytes:byte[]

a byte array

appendBitsback to summary
public void appendBits(byte b)

Appends all bits in a byte to the end of the bit string.

Parameters
b:byte

a byte

getBytesback to summary
public byte[] getBytes()
getLeadingAsIntback to summary
public int getLeadingAsInt(int numBits)

Returns up to 32 bits from the beginning of the bit string.

Parameters
numBits:int

number of bits

Returns:int

an int whose lower numBits bits are the beginning of the bit string

getTrailingback to summary
public IndexGenerator.BitString getTrailing(int numBits)

Returns the last numBits bits from the end of the bit string.

Parameters
numBits:int

number of bits

Returns:IndexGenerator.BitString

a new BitString of length numBits