Top Fields Constructors Methods
org.bouncycastle.pqc.crypto.bike

pack-priv Class BIKEEngine

extends Object
Class Inheritance
Imports
java.security.SecureRandom, org.bouncycastle.crypto.Xof, org.bouncycastle.crypto.digests.SHA3Digest, .SHAKEDigest, org.bouncycastle.util.Arrays, .Bytes

Field Summary

Modifier and TypeField and Description
private final BIKERing
private int
private int
private int
private int
r

private int
private int
private int
t

private int
private int
w

Constructor Summary

AccessConstructor and Description
public
BIKEEngine(int r, int w, int t, int l, int nbIter, int tau)

Method Summary

Modifier and TypeMethod and Description
private void
BFIter(byte[] s, byte[] e, int T, int[] h0Compact, int[] h1Compact, int[] h0CompactCol, int[] h1CompactCol, byte[] black, byte[] gray, byte[] ctrs)

private void
BFIter2(byte[] s, byte[] e, int T, int[] h0Compact, int[] h1Compact, int[] h0CompactCol, int[] h1CompactCol, byte[] ctrs)

private void
BFMaskedIter(byte[] s, byte[] e, byte[] mask, int T, int[] h0Compact, int[] h1Compact, int[] h0CompactCol, int[] h1CompactCol)

private byte[]
BGFDecoder(byte[] s, int[] h0Compact, int[] h1Compact)

private byte[]
computeSyndrome(byte[] c0, byte[] h0)

private void
convertToCompact(int[] compactVersion, byte[] h)

private int
ctr(int[] hCompactCol, byte[] s, int j)

private void
ctrAll(int[] hCompactCol, byte[] s, byte[] ctrs)

public void
decaps(byte[]
session key
k
,
byte[]
private key
h0
,
byte[]
private key
h1
,
byte[]
private key
sigma
,
byte[]
ciphertext
c0
,
byte[]
ciphertext
c1
)

KEM Decapsulation - Input: (h0, h1, sigma), (c0, c1) - Output: k

public void
encaps(byte[]
ciphertext
c0
,
byte[]
ciphertext
c1
,
byte[]
session key
k
,
byte[]
public key
h
,
SecureRandom
Secure Random
random
)

KEM Encapsulation - Input: h - Output: (c0,c1,k)

private byte[]
functionH(byte[] seed)

private void
functionK(byte[] m, byte[] c0, byte[] c1, byte[] result)

private void
functionL(byte[] e0, byte[] e1, byte[] result)

public void
genKeyPair(byte[]
h0
h0
,
byte[]
h1
h1
,
byte[]
sigma
sigma
,
byte[]
h
h
,
SecureRandom
Secure Random
random
)

Generate key pairs - Secret key : (h0, h1, sigma) - Public key: h

private int[]
public int
private void
recomputeSyndrome(byte[] syndrome, int index, int[] h0Compact, int[] h1Compact, boolean isOne)

private void
splitEBytes(byte[] e, byte[] e0, byte[] e1)

private int
threshold(int hammingWeight, int r)

private static int
thresholdFromParameters(int hammingWeight, double dm, double da, int min)

private void
updateNewErrorIndex(byte[] e, int index, boolean isOne)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bikeRingback to summary
private final BIKERing bikeRing
hwback to summary
private int hw
L_BYTEback to summary
private int L_BYTE
nbIterback to summary
private int nbIter
rback to summary
private int r
R2_BYTEback to summary
private int R2_BYTE
R_BYTEback to summary
private int R_BYTE
tback to summary
private int t
tauback to summary
private int tau
wback to summary
private int w

Constructor Detail

BIKEEngineback to summary
public BIKEEngine(int r, int w, int t, int l, int nbIter, int tau)

Method Detail

BFIterback to summary
private void BFIter(byte[] s, byte[] e, int T, int[] h0Compact, int[] h1Compact, int[] h0CompactCol, int[] h1CompactCol, byte[] black, byte[] gray, byte[] ctrs)
BFIter2back to summary
private void BFIter2(byte[] s, byte[] e, int T, int[] h0Compact, int[] h1Compact, int[] h0CompactCol, int[] h1CompactCol, byte[] ctrs)
BFMaskedIterback to summary
private void BFMaskedIter(byte[] s, byte[] e, byte[] mask, int T, int[] h0Compact, int[] h1Compact, int[] h0CompactCol, int[] h1CompactCol)
BGFDecoderback to summary
private byte[] BGFDecoder(byte[] s, int[] h0Compact, int[] h1Compact)
computeSyndromeback to summary
private byte[] computeSyndrome(byte[] c0, byte[] h0)
convertToCompactback to summary
private void convertToCompact(int[] compactVersion, byte[] h)
ctrback to summary
private int ctr(int[] hCompactCol, byte[] s, int j)
ctrAllback to summary
private void ctrAll(int[] hCompactCol, byte[] s, byte[] ctrs)
decapsback to summary
public void decaps(byte[] k, byte[] h0, byte[] h1, byte[] sigma, byte[] c0, byte[] c1)

KEM Decapsulation - Input: (h0, h1, sigma), (c0, c1) - Output: k

Parameters
k:byte[]

session key

h0:byte[]

private key

h1:byte[]

private key

sigma:byte[]

private key

c0:byte[]

ciphertext

c1:byte[]

ciphertext

encapsback to summary
public void encaps(byte[] c0, byte[] c1, byte[] k, byte[] h, SecureRandom random)

KEM Encapsulation - Input: h - Output: (c0,c1,k)

Parameters
c0:byte[]

ciphertext

c1:byte[]

ciphertext

k:byte[]

session key

h:byte[]

public key

random:SecureRandom

Secure Random

functionHback to summary
private byte[] functionH(byte[] seed)
functionKback to summary
private void functionK(byte[] m, byte[] c0, byte[] c1, byte[] result)
functionLback to summary
private void functionL(byte[] e0, byte[] e1, byte[] result)
genKeyPairback to summary
public void genKeyPair(byte[] h0, byte[] h1, byte[] sigma, byte[] h, SecureRandom random)

Generate key pairs - Secret key : (h0, h1, sigma) - Public key: h

Parameters
h0:byte[]

h0

h1:byte[]

h1

sigma:byte[]

sigma

h:byte[]

h

random:SecureRandom

Secure Random

getColumnFromCompactVersionback to summary
private int[] getColumnFromCompactVersion(int[] hCompact)
getSessionKeySizeback to summary
public int getSessionKeySize()
recomputeSyndromeback to summary
private void recomputeSyndrome(byte[] syndrome, int index, int[] h0Compact, int[] h1Compact, boolean isOne)
splitEBytesback to summary
private void splitEBytes(byte[] e, byte[] e0, byte[] e1)
thresholdback to summary
private int threshold(int hammingWeight, int r)
thresholdFromParametersback to summary
private static int thresholdFromParameters(int hammingWeight, double dm, double da, int min)
updateNewErrorIndexback to summary
private void updateNewErrorIndex(byte[] e, int index, boolean isOne)