de.flexiprovider.pqc.ecc
Class Conversions

java.lang.Object
  |
  +--de.flexiprovider.pqc.ecc.Conversions

public final class Conversions
extends java.lang.Object

Provides methods for CCA2-Secure Conversions of McEliece PKCS

Author:
Elena Klintsevich

Method Summary
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).
static GF2Vector encode(int n, int t, byte[] m)
          Encode a number between 0 and (n|t) (binomial coefficient) into a binary vector of length n with weight t.
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.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static GF2Vector encode(int n,
                               int t,
                               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 - integer
t - integer
m - the message as a byte array
Returns:
the encoded message as GF2Vector

decode

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 - integer
t - integer
vec - the binary vector
Returns:
the decoded vector as a byte array

signConversion

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 - integer
t - integer
m - the message vector as a byte array
Returns:
a message representative for m