|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HFE.HFE4_3
This class is the "toy version" of HFE which works on
6 bits over the field F_4 (Field4
) which
extents to F_64.
Field Summary | |
private static int[] |
codeVec
Cipher as a vector. |
private java.security.MessageDigest |
digest
Stores a copy of the message digest which is used to get one unique solution |
private Poly64Max |
privatePoly
Stores the private polynomial over F_64. |
private Poly4MultiSquare[] |
publicPoly
Stores the public key matrix of polynomials over GF(4). |
private static int[] |
resVec
Message as a vector. |
private static int[] |
textVec
Message as a vector. |
private Transform4 |
transS
Transformation S in HFE |
private Transform4 |
transT
Transformation T in HFE |
private static int[] |
valueVec
Message in a special format as a vector. |
Constructor Summary | |
(package private) |
HFE4_3(long seed)
Initializes HFE4_3 by generating the public and the private key from the given seed. |
Method Summary | |
(package private) int |
decrypt(int cipherHash)
Decryptes a given, 22 bit ciphertext / hash |
(package private) int |
encrypt(int plain)
Encryptes a given, 6 bit plain text. |
(package private) int |
filterRoots(java.util.Collection resColl,
int hash)
Finds out which roots are correct acording to the given hash. |
(package private) void |
generateKeys(long seed)
Generates the public and the private key from a given seed and stores them in the object's fields. |
private static Poly64Max |
genPolyPrivate(int[] coeff)
Generates a private key for HFE. |
private Poly4MultiSquare[] |
genPolyPublic(int[] coeff)
Generates the 3 public polynomial from the object's private polynomial. |
(package private) java.util.Collection |
getRoots(Poly64Max masterPoly,
int a)
Calculates the root for a given Polynomial and a given element of F_64. |
(package private) int |
giveHash(int plain)
Produces a 16 bit hash for the given plaintext. |
private static void |
int2vec(int in,
int[] out)
computes an vector of integers out of one integer |
static void |
main(java.lang.String[] args)
Tests everything in this class |
static void |
speedIt()
|
static void |
testIt()
Tests the functionality of the whole class. |
private static int |
vec2int(int[] in)
computes an vector of integers out of one integer |
Methods inherited from class java.lang.Object |
|
Field Detail |
private Poly64Max privatePoly
private Poly4MultiSquare[] publicPoly
private final java.security.MessageDigest digest
private Transform4 transS
private Transform4 transT
private static int[] textVec
private static int[] resVec
private static int[] valueVec
private static int[] codeVec
Constructor Detail |
HFE4_3(long seed) throws java.security.NoSuchAlgorithmException
seed
- Seed for the cryptographic random number generator.
Caution! This seed is to short for cryptographic purposes!Method Detail |
int giveHash(int plain)
plain
- Plaintext in the lower 6 bitsprivate static void int2vec(int in, int[] out)
private static int vec2int(int[] in)
private static Poly64Max genPolyPrivate(int[] coeff)
coeff
- Coefficients for the private polynomialprivate Poly4MultiSquare[] genPolyPublic(int[] coeff)
coeff
- Coefficients for the private polynomialtau(n)
[here: n=3, tau(3)=10]void generateKeys(long seed)
seed
- Seed for the random number generatorjava.util.Collection getRoots(Poly64Max masterPoly, int a)
int filterRoots(java.util.Collection resColl, int hash)
int encrypt(int plain)
plain
- plaintext in the lower 6 bitsint decrypt(int cipherHash)
cipherHash
- 22 bit where the lower 6 bits are the cipher text and the
bits 6..21 are hash of the plaintext.public static void testIt()
public static final void speedIt()
public static void main(java.lang.String[] args)
testIt()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |