# Hidden Field Equations

Hidden Fields Equations (HFE) is a public key cryptosystem which was introduced at Eurocrypt in 1996 and proposed by (French) Jacques Patarin following the idea of the Matsumoto and Imai system. HFE is also known as HFE trapdoor function. It is based on polynomials over finite fields $\mathbb{F}_q$ of different size to disguise the relationship between the private key and public key. HFE is in fact a family which consists of basic HFE and combinatorial versions of HFE. The HFE family of cryptosystems is based on the hardness of the problem of finding solutions to a system of multivariate quadratic equations (the so called MQ problem) since it uses private affine transformations to hide the extension field and the private polynomials. Hidden Field Equations also have been used to construct digital signature schemes, e.g. Quartz and Sflash.[1]

## Mathematical background

One of the central notions to understand how Hidden Field Equations work is to see that for two extension fields $\mathbb{F}_{q^n}$$\mathbb{F}_{q^m}$ over the same base field $\mathbb{F}_q$ one can interpret a system of $m$ multivariate polynomials in $n$ variables over $\mathbb{F}_q$ as a function $\mathbb{F}_{q^n} \to \mathbb{F}_{q^m}$ by using a suitable basis of $\mathbb{F}_{q^n}$ over $\mathbb{F}_q$. In almost all applications the polynomials are quadratic, i.e. they have degree 2.[2] We start with the simplest kind of polynomials, namely monomials, and show how they lead to quadratic systems of equations.

Let us consider a finite field $\mathbb{F}_q$, where $q$ is a power of 2, and an extension field $K$. Let $\beta_1,...,\beta_n$ to be a basis of $K$ as an $\mathbb{F}_q$vector space. Let $0 such that $h=q^{\theta}+1$ for some $\theta$ and gcd$(h,q^n-1)=1$ and take a random element $u\in \mathbb{F}_{q^n}$. We represent $u$ with respect to the basis as $u=(u_1,...,u_n)$. Define $v\in \mathbb{F}_{q^n}$ by

$v=u^{q^\theta} u \ \ \ \ (1)$

The condition gcd$(h,q^n-1) =1$ is equivalent to requiring that the map $u \to u^h$ on $K$ is one to one and its inverse is the map $u \to u^{h'}$ where $h'$ is the multiplicative inverse of $h \ \bmod q^n-1$. Choose two secret affine transformation, i.e. two invertible $n\times n$ matrices $S=\{S_{ij}\}$ and $T=\{T_{ij}\}$ with entries in $\mathbb{F}_q$ and two vectors $c=(c_1,...,c_n)$ and $d=(d_1,...,d_n)$ of length $n$ over $\mathbb{F}_q$ and define $x$ and $y$ via:

$u=Sx+c \ \ \ \ v=Ty+d \ \ \ \ (2)$

Let $A^{(k)}={a_{ij}^{(k)}}$ be the matrix of linear transformation in the basis $\beta_1,...,\beta_n$ such that

$\beta_{i}^{q^k}=\sum_{j=1}^{n} a_{ij}^{k}\beta_{j},\ \ a_{ij}^{k}\in\mathbb{F}_q$

for $1\le i,k\le n$. Write all products of basis elements in terms of the basis, i.e.:

$\beta_i\beta_j=\sum_{l=1}^{n}m_{ijl}\beta_{l},\ \ m_{ijl}\in\mathbb{F}_q$

for each $1\le i,j\le n$. The system of $n$ equations which is explicit in the $v_i$ and quadratic in the $u_j$ can be obtain by expanding (1) and equating to zero the coefficients of the $\beta_i$. By using the affine relations in (2) to replace the $u_j, v_i$ with $x_k,y_l$, the system of $n$ equations is linear in the $y_l$ and of degree 2 in the $x_k$. Applying linear algebra it will give $n$ explicit equations, one for each $y_l$ as polynomials of degree 2 in the $x_k$.[3]

↑Jump back a section

## Multivariate cryptosystem

The basic idea of the HFE family of using this as a multivariate cryptosystem is to build the secret key starting from a polynomial $P$ in one unknown $x$ over some finite field $\mathbb{F}_{q^n}$ (normally value $q=2$ is used). This polynomial can be easily inverted over $\mathbb{F}_{q^n}$, i.e. it is feasible to find any solutions to the equation $P(x)=y$ when such solution exist. The secret transformation either decryption and/or signature is based on this inversion. As explained above $P$ can be identified with a system of $n$ equations $(p_1,...,p_n)$ using a fixed basis. To build a cryptosystem the polynomial $(p_1,...,p_n)$ must be transformed so that the public information hides the original structure and prevents inversion. This is done by viewing the finite fields $\mathbb{F}_{q^n}$ as a vector space over $\mathbb{F}_q$ and by choosing two linear affine transformations $S$ and $T$. The triplet $(S,P,T)$ constitute the private key. The private polynomial $P$ is defined over $\mathbb{F}_{q^n}$.[1][4] The public key is $(p_1,...,p_n)$. Below is the diagram for MQ-trapdoor $(S,P,T)$ in HFE

$\text{input} x\to x=(x_1,...,x_n)\overset{\text{secret}: S}{\to}x'\overset{\text{secret}: P}{\to}y'\overset{\text{secret}: T}{\to}\text{output} y$
↑Jump back a section

## HFE polynomial

The private polynomial $P$ with degree $d$ over $\mathbb{F}_{q^n}$ is an element of $\mathbb{F}_{q^n}[x]$. If the terms of polynomial $P$ have at most quadratic terms over $\mathbb{F}_{q}$ then it will keep the public polynomial small.[1] The case that $P$ consists of monomials of the form $x^{q^{s_i}+q^{t_i}}$, i.e. with 2 powers of $q$ in the exponent is the basic version of HFE, i.e. $P$ is chosen as

$P(x)=\sum c_i x^{q^{s_i}+q^{t_i}}$

The degree $d$ of the polynomial is also known as security parameter and the bigger its value the better for security since the resulting set of quadratic equations resembles a randomly chosen set of quadratic equations. On the other side large $d$ slows down the deciphering. Since $P$ is a polynomial of degree at most $d$ the inverse of $P$, denoted by $P^{-1}$ can be computed in $d^2(\ln d)^{O(1)} n^2 \mathbb{F}_q$ operations.[5]

↑Jump back a section

## Encryption and decryption

The public key is given by the $n$ multivariate polynomials $(p_1,...,p_n)$ over $\mathbb{F}_q$. It is thus necessary to transfer the message $M$ from $\mathbb{F}_{q^n} \to \mathbb{F}_q^n$ in order to encrypt it, i.e. we assume that $M$ is a vector $(x_1,...,x_n)\in \mathbb{F}_q^n$. To encrypt message $M$ we evaluate each $p_i$ at $(x_1,...,x_n)$. The ciphertext is $(p_1(x_1,...,x_n), p_2(x_1,...,x_n), ... ,p_n(x_1,...,x_n))\in \mathbb{F}_q^n$.

To understand decryption let us express encryption in terms of $S, T, P$. Note that these are not available to the sender. By evaluating the $p_i$ at the message we first apply $S$, resulting in $x'$. At this point $x'$ is transferred from $\mathbb{F}{q^n} \to \mathbb{F}_{q^n}$ so we can apply the private polynomial $P$ which is over $\mathbb{F}_{q^n}$ and this result is denoted by $y'\in \mathbb{F}_{q^n}$. Once again, $y'$ is transferred to the vector $(y_1',...,y_n')$ and the transformation $T$ is applied and the final output $y\in \mathbb{F}_{q^n}$ is produced from $(y_1,...,y_n)\in \mathbb{F}_q^n$.

To decrypt $y$, the above steps are done in reverse order. This is possible if the private key $(S,P,T)$ is known. The crucial step in the deciphering is not the inversion of $S$ and $T$ but rather the computations of the solution of $P(x')=y'$. Since $P$ is not necessary a bijection, one may find more than one solution to this inversion (there exist at most d different solutions $X'=(x_1',...,x_d')\in\mathbb{F}_{q^n}$ since $P$ is a polynomial of degree d). The redundancy denoted as $r$ is added at the first step to the message $M$ in order to select the right $M$ from the set of solutions $X'$.[1][3][6] The diagram below shows the basic HFE for encryption.

$M\overset{+r}{\to}x\overset{\text{secret}: S}{\to}x'\overset{\text{secret}: P}{\to}y'\overset{\text{secret}: T}{\to}y$
↑Jump back a section

## HFE variations

Hidden Field Equations has four basic variations namely +,-,v and f and it is possible to combine them in various way. The basic principle is the following:

01. The + sign consists of linearity mixing of the public equations with some random equations.
02. The - sign is due to Adi Shamir and intends to remove the redundancy 'r' of the public equations.
03. The f sign consists of fixing some $f$ input variables of the public key.
04. The v sign is defined as a construction and sometimes quite complex such that the inverse of the function can be found only if some v of the variables called vinegar variables are fixed. This idea is due to Jacques Patarin.

The operations above preserve to some extent the trapdoor solvability of the function.

HFE- and HFEv are very useful in signature schemes as they prevent from slowing down the signature generation and also enhance the overall security of HFE whereas for encryption both HFE- and HFEv will lead to a rather slow decryption process so neither too many equations can be removed (HFE-) nor too many variables should be added (HFEv). Both HFE- and HFEv were used to obtain Quartz.

For encryption, the situation is better with HFE+ since the decryption process takes the same amount of time, however the public key has more equations than variables.[1][2]

↑Jump back a section

## HFE attacks

There are two famous recent attacks on HFE:

01. Shamir-Kipnis: Recover the Private Key.

The key point of this attack is to recover the private key as sparse univariate polynomials over the extension field $\mathbb{F}_{q^n}$. The attack only works for basic HFE and fails for all its variations.

02. Faugere: Fast Gröbner Bases.

The idea of Faugere's attacks is to use fast algorithm to compute a Gröbner basis of the system of polynomial equations. Faugere broke the HFE challenge 1 in 96 hours in 2002 and in 2003 Faugere and Joux worked together on the security of HFE.[1]

↑Jump back a section