1 Introduction

Throughout this paper, let \(p\) be an odd prime and \(q=p^{e}\) for a positive integer \(e\). Denote by \(\mathbb {F}_{q}\) a finite field with \(q\) elements. An \([n, \kappa , \delta ]\) linear code \(C\) over \(\mathbb {F}_{p}\) is a \(\kappa \)-dimensional subspace of \(\mathbb {F}_{p}^{n}\) with minimum distance \(\delta \) (see [20]). Let \(A_{i}\) denote the number of codewords with Hamming weight \(i\) in a linear code \(C\) of length \(n\). Then \(1+A_{1}z+A_{2}z^{2}+\cdots +A_{n}z^{n} \) is defined to be the weight enumerator of \(C\).

The complete weight enumerator of a code enumerates the codewords according to the number of symbols of each kind contained in each codeword. Let the elements of \(\mathbb {F}_{p} \) be denoted by \( w_{0}= 0 \), \( w_{1},\cdots ,w_{p-1} \), in some fixed order. Also, let \(\mathbb {F}_{p}^{*}\) denote \(\mathbb {F}_{p}\backslash \{0\}\). For a codeword \(\mathsf {c}=(c_{0},c_{1},\cdots ,c_{n-1})\in \mathbb {F}_{p}^{n}\), let \(w[\mathsf {c}]\) be the complete weight enumerator of \(\mathsf {c}\), which is defined as

$$w[\mathsf{c}]=w_{0}^{k_{0}}w_{1}^{k_{1}}\cdots w_{p-1}^{k_{p-1}},$$

where \(k_{j}\) is the number of components of \(\mathsf {c}\) equal to \(w_{j}\), \(\sum _{j = 0}^{p-1}k_{j}=n\). The complete weight enumerator of the code \(C\) is then

$$\text{CWE}(C)=\sum_{\mathsf{c}\in C}w[\mathsf{c}].$$

The weight enumerators of linear codes have been well studied in literature, see, for example, [11, 12, 22, 29, 30] and references therein. The information of the complete weight enumerators of linear codes is of vital use because they not only give the weight enumerators but also show the frequency of each symbol appearing in each codeword. Furthermore the complete weight enumerator has close relation to the deception probabilities of certain authentication codes [7], and is used to compute the Walsh transform of monomial and quadratic bent functions over finite fields [13]. Further research can be found in [2, 3, 8, 15, 16, 25, 26].

The authors of [6, 9, 10] gave the following generic construction of linear codes. Set \(D=\{d_{1},d_{2},\cdots ,d_{n}\}\subseteq \mathbb {F}_{q}^{*}\), where \(q=p^{e}\). Denote by \(\text {Tr}\) the absolute trace function from \( \mathbb {F}_{q} \) to \( \mathbb {F}_{p} \). A linear code associated with \(D\) is defined by

$$ C_{D}=\{(\text{Tr}(ad_{1}),\text{Tr}(ad_{2}),\cdots,\text{Tr}(ad_{n})): a\in \mathbb{F}_{q}\}. $$

The set \(D\) is called the defining set of \(C_{D}\). This construction technique leads to a new research and was employed to construct linear codes with a few weights, see [1, 14, 17, 18, 23, 24, 27] for more details.

Motivated by the above construction and the idea of [23], we investigate a class of linear codes with defining set. Recall \(q=p^{e}\). Let \( d=\gcd (k,e) \) be the greatest common divisor of positive integers \( k \) and \( e \). Suppose that \( e/d \) is even with \( e = 2m \). The code is defined by

$$ C_{D_{b}}=\{(\text{Tr}(ax^{p^{k}+ 1}))_{x\in D_{b}}: a\in \mathbb{F}_{p^{d}}\}, $$
(1)

with defining set

$$D_{b}=\{x\in \mathbb{F}_{q}^{*}:\text{Tr}(x)=b\} \textup{ for } b\in \mathbb{F}_{p}. $$

The remainder of this paper is organized as follows. In Section 2, we describe the main results of this paper, additionally we give some examples. In Section 3, we briefly recall some definitions and results on cyclotomic numbers and exponential sums, then prove the main results. In Section 4, we make a conclusion.

2 Main results

In this section, we only introduce the complete weight enumerator and weight enumerator of \(C_{D_{b}}\) described in Section 1. The main results of this paper are presented below, whose proofs will be given in Section 3.

Theorem 1

If \( b = 0 \),then the code \( C_{D_{0}} \)of(1) is a \( [p^{e-1}-1, d ] \)linearcode and the following assertions hold.

  1. (i)

    Whenm/d ≡ 1 mod 2 andm/d≢0 mod p, its weight enumeratoris

    $$1+ (p-1)p^{d-1} z^{(p-1) p^{e-2}} + (p^{d-1}-1) z^{(p-1) (p^{e-2}+ p^{m-1})} $$

    and its complete weight enumerator is

    $$\begin{array}{@{}rcl@{}} && w_{0}^{p^{e-1}-1}+ \dfrac{p-1}{2} p^{d-1} w_{0}^{ p^{e-2}-1} {\left( { \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}-\eta(\rho )p^{m-1}} + \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}+\eta(\rho )p^{m-1}} } \right) }\\ &&+ (p^{d-1}-1) w_{0}^{ p^{e-2}-(p-1)p^{m-1}-1} \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}+p^{m-1}}. \end{array} $$
  2. (ii)

    When m/d ≡ 1 mod 2 and m/d ≡ 0 mod p , the code \( C_{D_{0}} \) has only one non-zero weight (p − 1)(pe− 2 + pm− 1) and its complete weight enumerator is

    $$w_{0}^{p^{e-1}-1}+ (p^{d}-1) w_{0}^{ p^{e-2}-(p-1)p^{m-1}-1} \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}+p^{m-1}}. $$
  3. (iii)

    When m/d ≡ 0 mod 2 and m/d≢0 mod p, its weight enumerator is

    $$1+ (p-1)p^{d-1} z^{(p-1) p^{e-2}} + (p^{d-1}-1) z^{(p-1) (p^{e-2}+ p^{m+d-1})} $$

    and its complete weight enumerator is

    $$\begin{array}{@{}rcl@{}} &&w_{0}^{p^{e-1}-1}\!+\! \frac{p-1}{2}p^{d-1} w_{0}^{ p^{e-2}-1} {\!\left( {\prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}-\eta(\rho)p^{m+d-1}} \!+\! \prod_{\rho \in\mathbb{F}_{p}^{*} } w_{\rho}^{ p^{e-2}+\eta(\rho)p^{m+d-1}}} \right) } \\ &&+ (p^{d-1}-1) w_{0}^{ p^{e-2}-(p-1)p^{m+d-1}-1} \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}+p^{m+d-1}}. \end{array} $$
  4. (iv)

    When m/d ≡ 0 mod 2 and m/d ≡ 0 mod p, the code \( C_{D_{0}} \) has only one non-zero weight (p − 1)(pe− 2 + pm + d− 1) and its complete weight enumerator is

    $$w_{0}^{p^{e-1}-1}+ (p^{d}-1) w_{0}^{ p^{e-2}-(p-1)p^{m+d-1}-1} \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}+p^{m+d-1}}. $$

Theorem 2

If \( b\in \mathbb {F}_{p}^{*} \), then thecode \( C_{D_{b}} \)of (1) is a \( [p^{e-1}, d, (p-1) p^{e-2} ] \)linearcode and the following assertions hold.

  1. (i)

    Whenm/d ≡ 1 mod 2 andm/d≢0 mod p, its weight enumeratoris

    $$1+ (p^{d-1}-1) z^{(p-1) p^{e-2}} + (p-1)p^{d-1} z^{(p-1) p^{e-2}+ p^{m-1}} $$

    and its complete weight enumerator is

    $$w_{0}^{p^{e-1}}+ (p^{d-1}-1) \prod_{\rho \in\mathbb{F}_{p} }w_{\rho}^{ p^{e-2}}+ p^{d-1} w_{0}^{ p^{e-2}-p^{m-1}} \sum_{\lambda \in\mathbb{F}_{p}^{*} } \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}-\eta(b^{2}-\rho\lambda)p^{m-1}} . $$
  2. (ii)

    When m/d ≡ 0 mod 2 and m/d≢0 mod p, its weight enumerator is

    $$1+ (p^{d-1}-1) z^{(p-1) p^{e-2}} + (p-1)p^{d-1} z^{(p-1) p^{e-2}+ p^{m+d-1}} $$

    and its complete weight enumerator is

    $$w_{0}^{p^{e-1}}+ (p^{d-1}-1) \prod_{\rho \in\mathbb{F}_{p} }w_{\rho}^{ p^{e-2}} +p^{d-1} w_{0}^{ p^{e-2}-p^{m+d-1}} \sum_{\lambda \in\mathbb{F}_{p}^{*} } \prod_{\rho \in\mathbb{F}_{p}^{*} }w_{\rho}^{ p^{e-2}-\eta(b^{2}-\rho\lambda)p^{m+d-1}} . $$
  3. (iii)

    When m/d ≡ 0 mod p, the code \( C_{D_{b}} \) has only one non-zero weight (p − 1)pe− 2 and its complete weight enumerator is

    $$w_{0}^{p^{e-1}}+ (p^{d}-1) \prod_{\rho \in\mathbb{F}_{p} }w_{\rho}^{ p^{e-2}}. $$

Some concrete examples are provided below to illustrate our results.

Example 1

Let \((p,m,k)=(5,2,2)\). Then \( d=\gcd (2m,k)= 2 \) and \( s=m/d = 1 \). If \( b = 0 \), the code \(C_{D_{0}}\) has parameters \([124, 2, 100]\), weight enumerator \( 1 + 20 z^{100} + 4 z^{120}\) and complete weight enumerator

$$w_{0}^{124}+ 10 w_{0}^{24}(w_{1} w_{4})^{20} (w_{2} w_{3})^{30} + 10 w_{0}^{24}(w_{1} w_{4})^{30} (w_{2} w_{3})^{20} + 4 {w_{0}^{4}}(w_{1} w_{2} w_{3} w_{4})^{30} . $$

If \( b = 1 \), the code \(C_{D_{1}}\) has parameters \([125, 2, 100]\), weight enumerator \( 1 + 4 z^{100} + 20 z^{105} \) and complete weight enumerator

$$w_{0}^{125}+ 4 \!\prod_{\rho= 0}^{4} w_{\rho}^{25} + 5 w_{0}^{20} \left( \! w_{1}^{25}w_{2}^{20}w_{3}^{30}w_{4}^{30} \!+\! w_{1}^{30}w_{2}^{25}w_{3}^{30}w_{4}^{20} \!+\!w_{1}^{20}w_{2}^{30}w_{3}^{25}w_{4}^{30} \!+\! w_{1}^{30}w_{2}^{30}w_{3}^{20}w_{4}^{25} \!\right). $$

These results are checked by Magma.

Example 2

Let \((p,m,k)=(3,3,1)\). Then \( d=\gcd (2m,k)= 1 \) and \( s=m/d = 3 \). If \( b = 0 \), the code \(C_{D_{0}}\) has parameters \([242, 1, 180]\), weight enumerator \( 1 + 2 z^{180} \) and complete weight enumerator \( w_{0}^{242}+ 2 w_{0}^{62}(w_{1} w_{2})^{90} \). If \( b = 1 \), the code \(C_{D_{1}}\) has parameters \([243, 1, 162]\), weight enumerator \( 1 + 2 z^{162} \) and complete weight enumerator \( w_{0}^{243}+ 2 (w_{0} w_{1} w_{2})^{81} \). These results are checked by Magma.

3 The proofs of the main results

3.1 Auxiliary results

In order to prove the results proposed in Section 2, we will use several results which are depicted and proved in the sequel. We start with the concepts of cyclotomic numbers and exponential sums over finite fields. Recall that \(q=p^{e}\). Let \(\theta \) be a primitive element of \(\mathbb {F}_{q}\) and \(q= Nh+ 1\) for integers \(N>1\), \(h>1\). The cyclotomic classes of order \(N\) in \(\mathbb {F}_{q}\) are the cosets \(C_{i}^{(N,q)}=\theta ^{i}\langle \theta ^{N}\rangle \) for \(i = 0,1,\cdots ,N-1\), where \(\langle \theta ^{N}\rangle \) denotes the subgroup of \(\mathbb {F}_{q}^{*}\) generated by \( \theta ^{N}\). For fixed \( i \) and \( j \), we define the cyclotomic number\( (i,j)^{(N,\,q)} \) to be the number of solutions of the equation

$$x_{i}+ 1=x_{j} ~~~ {\left( x_{i} \in C_{i}^{(N,\,q)} ,\,\, x_{j} \in C_{j}^{(N,\,q)} \right)}, $$

where \( 1=\theta ^{0} \) is the multiplicative unit of \( \mathbb {F}_{q} \). That is, \( (i,j)^{(N,\,q)} \) is the number of ordered pairs \( (u,v) \) such that

$$\theta^{Nu+i}+ 1=\theta^{Nv+j} ~~~ (0\leqslant u,v \leqslant h-1). $$

Now we review some results on cyclotomic numbers.

Lemma 1 ([21] )

When \(N = 2\) , the cyclotomic numbers are given by

  1. (1)

    h even: \((0,0)^{(2,\,r)} =\frac {h-2}{2} \) , \( (0,1)^{(2,\,r)} =(1,0)^{(2,\,r)} =(1,1)^{(2,\,r)} = \frac {h}{2}\) .

  2. (2)

    h odd: \((0,0)^{(2,\,r)} =(1,0)^{(2,\,r)} =(1,1)^{(2,\,r)} =\frac {h-1}{2} \) , \( (0,1)^{(2,\,r)} = \frac {h + 1}{2}\) .

Next, let us introduce group characters and exponential sums. For each \(b\in \mathbb {F}_{q}\), an additive character \(\chi _{b}\) of \(\mathbb {F}_{q} \) is defined by \( \chi _{b}(x)=\zeta _{p}^{\text {Tr}(bx)}\) for all \(x\in \mathbb {F}_{q} \), where \(\zeta _{p}=\exp \left (\frac {2\pi \sqrt {-1} }{p}\right )\) and \(\text {Tr}\) is the simplification of the trace function \( \text {Tr}^{e}_{1} \) from \( \mathbb {F}_{q} \) to \( \mathbb {F}_{p} \). For \(b = 1\), \(\chi _{1}\) is called the canonical additive character of \(\mathbb {F}_{q}\).

Let \(\eta _{e}\) denote the quadratic character of \(\mathbb {F}_{q} \). The quadratic Gauss sum \(G(\eta _{e},\chi _{1})\) is defined by

$$G(\eta_{e}, \chi_{1} )=\sum_{x\in\mathbb{F}_{q}^{*}}\eta_{e}(x)\chi_{1}(x). $$

We denote \(G_{e}=G(\eta _{e}, \chi _{1} )\) and \(G=G(\eta , \chi _{1}^{\prime })\), where \( \eta \) and \(\chi _{1}^{\prime }\) are the quadratic character and canonical additive character of \(\mathbb {F}_{p}\), respectively. Moreover, it is well known that \(G_{e}=(-1)^{e-1}\sqrt {p^{*}}^{e}\) and \(G =\sqrt {p^{*}}\), where \(p^{*}= \eta (-1)p \). See [10, 19] for more information.

The following lemmas will be of special use in the sequel.

Lemma 2 (Theorem 5.33, [19])

Let \( q =p^{e}\)be oddand \(f(x)=a_{2}x^{2}+a_{1}x+a_{0}\in \mathbb {F}_{q}[x]\)with \(a_{2}\neq 0\).Then

$$\sum_{x\in \mathbb{F}_{q}}\zeta_{p}^{\text{Tr}(f(x))}=\zeta_{p}^{\text{Tr}(a_{0}-{a_{1}^{2}}(4a_{2})^{-1})}\eta_{e}(a_{2})G_{e}, $$

where \( \eta _{e} \) is the quadratic character of \( \mathbb {F}_{q}\).

For \( \alpha ,\beta \in \mathbb {F}_{q} \) and any integer \( k \), the exponential sum \( S(\alpha ,\beta ) \) is defined by

$$S(\alpha,\beta)=\sum_{x\in \mathbb{F}_{q} } \chi_{1}(\alpha x^{p^{k}+ 1}+\beta x). $$

We recall some results of \( S(\alpha ,\beta ) \) for \( \alpha \neq 0 \) and \( q \) odd.

Lemma 3 (Theorem 2, [4])

Let \( d=\gcd (k,e) \)and \( e/d \)beeven with \( e = 2m \).Then

$$S(\alpha,0)=\left\{\begin{array}{lll} (-1)^{s} p^{m} && \textup{ if } \alpha^{(q-1)/(p^{d}+ 1)} \neq (-1)^{s} ,\\ (-1)^{s + 1}p^{m+d} && \textup{ if } \alpha^{(q-1)/(p^{d}+ 1)} = (-1)^{s}, \end{array} \right. $$

where \( s=m/d \).

Lemma 4 (Theorem 4.7, [5])

Let \( \beta \neq 0 \) and \( e/d \) be even with \( e = 2m \) . Set \( f_{\alpha }(X)=\alpha ^{p^{k}} X^{p^{2k}} + \alpha X\) . Then \( S(\alpha ,\beta )= 0 \) unless the equation \( f_{\alpha }(X)=-\beta ^{p^{k}} \) is solvable. There are two possibilities.

  1. (i)

    If \( \alpha ^{(q-1)/(p^{d}+ 1)} \neq (-1)^{s} \) , then for any choice of \( \beta \in \mathbb {F}_{q} \) , the equation has a unique solution x 0 and

    $$S(\alpha,\beta)=(-1)^{s}p^{m} \chi_{1}(-\alpha x_{0}^{p^{k}+ 1}). $$
  2. (ii)

    If \( \alpha ^{(q-1)/(p^{d}+ 1)} = (-1)^{s} \) and the equation is solvable with some solution x0 say, then

    $$S(\alpha,\beta)=(-1)^{s + 1}p^{m+d} \chi_{1}(-\alpha x_{0}^{p^{k}+ 1}). $$

Lemma 5 (Theorem 4.1, [4])

For \( e = 2m \)theequation \( \alpha ^{p^{k}} X^{p^{2k} } +\alpha X = 0 \)issolvable for \( X \in \mathbb {F}_{q}^{*} \)ifand only if \( e/d \)iseven and

$$\alpha^{(q-1)/(p^{d}+ 1)} = (-1)^{s}. $$

In such cases there are \( p^{2d}- 1 \) non-zero solutions.

3.2 The proofs of the theorems in Section 2

In this subsection, we will prove of our main results presented in Section 2. Recall that \( q=p^{e} \), \( d=\gcd (k,e) \), \( e/d \) is even with \( e = 2m \). The code \( C_{D_{b}} \) with \( b\in \mathbb {F}_{p} \), is defined by

$$C_{D_{b}}=\{(\text{Tr}(ax^{p^{k}+ 1}))_{x\in D_{b}}: a\in \mathbb{F}_{p^{d}}\}, $$

where \( D_{b}=\{x\in \mathbb {F}_{q}^{*}:\text {Tr}(x)=b\} . \) It is trivial that \( C_{D_{b}} \) has length \( n_{0}=p^{e-1}-1 \) if \( b = 0 \) and \( n_{b}=p^{e-1} \) otherwise.

Observe that \(a = 0\) gives the zero codeword and the contribution to the complete weight enumerator is \({w_{0}^{n}}\). This value occurs only once. Hence, we may assume that \(a\in \mathbb {F}_{p^{d}}^{*}\) in the rest of this subsection.

For a codeword \( \mathsf {c}_{a} =(\text {Tr}(ax^{p^{k}+ 1}))_{x\in D_{b}} \) of \( C_{D_{b}} \) and \( \rho \in \mathbb {F}_{p} \), let \( n_{a}(b,\rho ) \) denote the number of components of \( \mathsf {c}_{a} \) that are equal to \( \rho \), i.e.,

$$n_{a}(b,\rho)=\# \{ x\in \mathbb{F}_{q}^{*}:\text{Tr}(x)=b \textup{ and } \text{Tr}(ax^{p^{k}+ 1})=\rho\}. $$

For convenience, we compute

$$N_{a}(b,\rho)=\# \{ x\in \mathbb{F}_{q} :\text{Tr}(x)=b \textup{ and } \text{Tr}(ax^{p^{k}+ 1})=\rho\}. $$

Then we have

$$ N_{a}(b,0)=p^{e-1}-\sum_{\rho \in \mathbb{F}_{p}^{*} } N_{a}(b,\rho). $$
(2)

Also it is easy to obtain the Hamming weight of \( \mathsf {c}_{a} \), that is

$$wt(\mathsf{c}_{a})=\sum_{\rho \in \mathbb{F}_{p}^{*} } N_{a}(b,\rho) = p^{e-1}-N_{a}(b,0). $$

So we only consider \( \rho \in \mathbb {F}_{p}^{*} \) and \(a\in \mathbb {F}_{p^{d}}^{*}\) in the sequel.

Now it comes to determine the value of \( N_{a}(b,\rho ) \) for \( \rho \in \mathbb {F}_{p}^{*} \). By definition, we have

$$\begin{array}{@{}rcl@{}} N_{a}(b,\rho) &=&p^{-2}\sum_{x\in\mathbb{F}_{q}} \sum_{y\in\mathbb{F}_{p}}\zeta_{p}^{y\text{Tr}(x)-by} \sum_{z\in\mathbb{F}_{p}}\zeta_{p}^{z\text{Tr}(ax^{p^{k}+ 1})-\rho z} \\ &=& p^{e-2} + p^{-2}\sum_{z\in\mathbb{F}_{p}^{*}} \sum_{x\in\mathbb{F}_{q}} \zeta_{p}^{z\text{Tr}(ax^{p^{k}+ 1})-\rho z} + p^{-2}\sum_{y\in\mathbb{F}_{p}^{*}}\sum_{x\in\mathbb{F}_{q}} \zeta_{p}^{y\text{Tr}(x)-by} \\ && +p^{-2}\sum_{y\in\mathbb{F}_{p}^{*}}\sum_{z\in\mathbb{F}_{p}^{*}}\sum_{x\in\mathbb{F}_{q}} \zeta_{p}^{\text{Tr}(azx^{p^{k}+ 1}+yx)-by-\rho z} \\ &=& p^{e-2} + p^{-2} A_{a}(\rho) + p^{-2}B_{a}(b,\rho), \end{array} $$
(3)

where

$$\begin{array}{@{}rcl@{}} A_{a}(\rho)&:=& \sum_{z\in\mathbb{F}_{p}^{*}} \sum_{x\in\mathbb{F}_{q}} \zeta_{p}^{z\text{Tr}(ax^{p^{k}+ 1})-\rho z} , \end{array} $$
(4)
$$\begin{array}{@{}rcl@{}} B_{a}(b,\rho)&:=&\sum_{y\in\mathbb{F}_{p}^{*}}\sum_{z\in\mathbb{F}_{p}^{*}}\sum_{x\in\mathbb{F}_{q}} \zeta_{p}^{\text{Tr}(azx^{p^{k}+ 1}+yx)-by-\rho z}. \end{array} $$
(5)

The following lemmas state the evaluations of \( A_{a}(\rho ) \) and \( B_{a}(b,\rho ) \).

Lemma 6

Let \( a\in \mathbb {F}_{p^{d}}^{*} \) and \( \rho \in \mathbb {F}_{p}^{*} \) . Denote \( s=m/d \) . Then

$$A_{a}(\rho)=\left\{\begin{array}{lll} p^{m} \phantom{(p-1)} && \textup{if } s \textup{ is odd},\\ p^{m+d} \phantom{(p-1)} && \textup{if } s \textup{ is even}. \end{array} \right. $$

Proof

By (4),

$$A_{a}(\rho) = \sum_{z\in\mathbb{F}_{p}^{*}} \zeta_{p}^{ -\rho z} S(az,0). $$

A straightforward calculation gives that \( (az)^{(q-1)/(p^{d}+ 1)}= 1 \) for \( z\in \mathbb {F}_{p}^{*} \) and \( a\in \mathbb {F}_{p^{d}}^{*} \). Then the desired conclusion follows from Lemma 3.

For the later use, we set \( f_{a}(X)= a X^{p^{2k}} + a X \in \mathbb {F}_{q}[X] \) for \( a\in \mathbb {F}_{p^{d}}^{*} \).

Lemma 7

Let \( b \in \mathbb {F}_{p} \) and \( \rho \in \mathbb {F}_{p}^{*} \) . Suppose that \( e/d \) is even with \( e = 2m \) and \( s=m/d \) . Then for each \( a\in \mathbb {F}_{p^{d}}^{*} \) , the equation \( f_{a}(X)=-1 \) has a solution \( \gamma =-1/(2a) \) and so \( B_{a}(b,\rho ) \neq 0 \) . Denote \( \lambda := \text {Tr}(a^{-1}) \) . The evaluation of \( B_{a}(b,\rho ) \neq 0 \) partitions into the following two cases.

  1. (i)

    Ifb = 0,then

    $$B_{a}(0,\rho)=\left\{\begin{array}{lll} (p-1) p^{m} && \textup{ if } s \textup{ is odd and } \lambda= 0,\\ - \left( p \eta(-\rho \lambda)+ 1\right) p^{m} && \textup{ if } s \textup{ is odd and } \lambda \neq 0,\\ (p-1) p^{m+d} && \textup{ if } s \textup{ is even and } \lambda= 0,\\ -\left( p \eta(-\rho \lambda)+ 1\right) p^{m+d} && \textup{ if } s \textup{ is even and } \lambda \neq 0. \end{array} \right. $$
  2. (ii)

    If b≠ 0, then

    $$B_{a}(b,\rho)=\left\{\begin{array}{lll} - p^{m} && \textup{ if } s \textup{ is odd and } \lambda= 0,\\ -\left( p \eta(b^{2}-\rho \lambda)+ 1\right) p^{m} && \textup{ if } s \textup{ is odd and } \lambda \neq 0,\\ -p^{m+d} && \textup{ if } s \textup{ is even and } \lambda= 0,\\ -\left( p \eta(b^{2}-\rho \lambda)+ 1\right) p^{m+d} && \textup{ if } s \textup{ is even and } \lambda \neq 0 . \end{array} \right. $$

Proof

Let \( e/d \) be even. By (5),

$$ B_{a}(b,\rho) =\sum_{y\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -by} \sum_{z\in\mathbb{F}_{p}^{*}} \zeta_{p}^{ -\rho z} S(az,y) . $$
(6)

For \( y,z\in \mathbb {F}_{p}^{*} \), it follows from Lemma 4 that \( S(az,y)= 0 \) unless the equation \( f_{az}(X)=-y^{p^{k}} \) is solvable. But for each \( a\in \mathbb {F}_{p^{d}}^{*} \), we can verify that \( \gamma =-1/(2a) \) is a solution of \( f_{a}(X)=a X^{p^{2k}} + a X =-1 \) and so \( z^{-1} \gamma y \) is a solution of \( f_{az}(X)=(az) X^{p^{2k}} + (az) X=-y^{p^{k}} \). This implies that \( B_{a}(b,\rho ) \neq 0 \).

For the evaluation of \( B_{a}(b,\rho ) \neq 0 \), we first consider the case that \( s \) is odd. In this case \( f_{az}(X) =-y^{p^{k}}\) has a unique solution \( z^{-1}\gamma y \) because \( f_{a}(X)=a X^{p^{2k}} + a X \) is a permutation polynomial over \( \mathbb {F}_{q} \) by Lemma 5 and \( \gamma \) is the unique solution of \( f_{a}(X) =-1\). Thus we have from Lemma 4 that

$$S(az,y)=-p^{m} \chi_{1}(-az(z^{-1}\gamma y)^{p^{k}+ 1}). $$

Plugging this into \( B_{a}(b,\rho ) \) of (6) gives that

$$\begin{array}{@{}rcl@{}} B_{a}(b,\rho)& =&-p^{m} \sum_{y\in\mathbb{F}_{p}^{*}}\sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -by-\rho z} \chi_{1}(-az(z^{-1}\gamma y)^{p^{k}+ 1})\\ &=&-p^{m} \sum_{y\in\mathbb{F}_{p}^{*}}\sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -by-\rho z} \zeta_{p}^{-\frac{\lambda y^{2}}{4z} }, \end{array} $$

where \( \lambda = \text {Tr}(a^{-1}) \).

If \(\lambda = 0 \), then \( B_{a}(b,\rho ) = -p^{m} \sum _{y\in \mathbb {F}_{p}^{*}}\sum _{z\in \mathbb {F}_{p}^{*}}\zeta _{p}^{ -by-\rho z} \) and the corresponding result then follows.

Now suppose that \(\lambda \neq 0 \) and we consider the following cases separately.

  1. (i)

    If b = 0, we have from Lemma 4 that

    $$\begin{array}{@{}rcl@{}} B_{a}(0,\rho) & =& -p^{m} \sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -\rho z} \sum_{y\in\mathbb{F}_{p}^{*}}\zeta_{p}^{-\frac{\lambda y^{2}}{4z} }\\ &=& -p^{m} \sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -\rho z} {\left( {\sum_{y\in\mathbb{F}_{p} }\zeta_{p}^{-\frac{\lambda y^{2}}{4z} } - 1} \right) }\\ &=& -p^{m} \sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -\rho z} \eta \left( -\frac{\lambda }{z}\right) G -p^{m}\\ &=& -p^{m} \eta(\rho \lambda ) G^{2} -p^{m} = - \left( p \eta(-\rho \lambda)+ 1\right) p^{m}. \end{array} $$
  2. (ii)

    If b≠ 0, then it follows from Lemma 4 again that

    $$\begin{array}{@{}rcl@{}} B_{a}(b,\rho)&=& -p^{m} \sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -\rho z} \sum_{y\in\mathbb{F}_{p}^{*}}\zeta_{p}^{-\frac{\lambda y^{2}}{4z}-by } \\ &=& -p^{m} \sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{ -\rho z} \zeta_{p}^{\frac{ b^{2}}{\lambda} z } \eta \left( -\frac{\lambda }{z}\right) G - p^{m}\\ &=& -p^{m} \sum_{z\in\mathbb{F}_{p}^{*}}\zeta_{p}^{(\frac{b^{2}}{\lambda} -\rho) z} \eta\left (-\frac{\lambda }{z}\right) G -p^{m}\\ &=&\left\{\begin{array}{lll} - p^{m} && \textup{ if } b^{2}= \rho \lambda,\\ -(p \eta(b^{2}- \rho \lambda)+ 1 )p^{m} && \textup{ if } b^{2} \neq \rho \lambda. \end{array} \right. \end{array} $$

Therefore we conclude that \( B_{a}(b,\rho ) = -(p \eta (b^{2}-\rho \lambda )+ 1 )p^{m} \) for \( b \neq 0 \).

We now study the case that \(s \) is even. Since \( z^{-1}\gamma y \) is a solution to \( f_{az}(X) =-y^{p^{k}} \), we have from Lemma 4 that

$$S(az,y)=-p^{m+d} \chi_{1}(-az (z^{-1}\gamma y)^{p^{k}+ 1}). $$

By a similar argument as above, we obtain the desired conclusions and complete the whole proof of this lemma.

3.2.1 The first case that b = 0

In this subsection, we assume that \( b = 0 \). Recall that \( s=m/d \) and \( \lambda = \text {Tr}(a^{-1}) \) for \( a\in \mathbb {F}_{p^{d}}^{*} \). By (2), (3), Lemmas 6 and 7, we have the following two lemmas.

Lemma 8

Let \( a\in \mathbb {F}_{p^{d}}^{*} \) , then

$$\begin{array}{@{}rcl@{}} N_{a}(0,0) &=& \left\{\begin{array}{lll} p^{e-2}- (p-1) p^{m-1} && \textup{ if } s \textup{ is odd and } \lambda= 0,\\ p^{e-2} && \textup{ if } s \textup{ is odd and } \lambda \neq 0,\\ p^{e-2}-(p-1) p^{m+d-1} && \textup{ if } s \textup{ is even and } \lambda= 0,\\ p^{e-2} && \textup{ if } s \textup{ is even and } \lambda \neq 0. \end{array} \right. \end{array} $$

Lemma 9

Let \( a\in \mathbb {F}_{p^{d}}^{*} \) and \( \rho \in \mathbb {F}_{p}^{*} \) , we have

$$N_{a}(0,\rho) = \left\{\begin{array}{lll} p^{e-2}+ p^{m-1} && \textup{ if } s \textup{ is odd and } \lambda= 0,\\ p^{e-2} - \eta(-\rho\lambda)p^{m-1} && \textup{ if } s \textup{ is odd and } \lambda \neq 0,\\ p^{e-2}+ p^{m+d-1} && \textup{ if } s \textup{ is even and } \lambda= 0,\\ p^{e-2} - \eta(-\rho\lambda)p^{m+d-1} && \textup{ if } s \textup{ is even and } \lambda \neq 0. \end{array} \right. $$

Now we are in a position to prove Theorem 1.

Proof

Denote

$$\begin{array}{@{}rcl@{}} w_{1}&=& (p-1) (p^{e-2}+ p^{m-1}),\\ w_{2}&=&(p-1) p^{e-2},\\ w_{3}&=&(p-1) (p^{e-2}+ p^{m+d-1}). \end{array} $$

The code \( C_{D_{0}} \) has length \( n_{0}= p^{e-1}-1 \) and dimension \( d \), since \( wt(\mathsf {c}_{a}) >0 \) for each \( a \in \mathbb {F}_{p^{d}}^{*} \). Observe that \( \lambda = \text {Tr}(a^{-1}) = \text {Tr}^{e}_{d} \left (\text {Tr}^{d}_{1}(a^{-1})\right )= 2s \text {Tr}^{d}_{1}(a^{-1}) \), where \( \text {Tr}^{e}_{d} \) is the trace function from \( \mathbb {F}_{p^{e}} \) to \( \mathbb {F}_{p^{d}} \). Therefore the calculation can be divided into four cases according to the values of \( p \) and \( s \). We only give the proof of two cases and the other two can be similarly treated.

  1. (i)

    When s is odd and \( p\nmid s \) , we have from the above two lemmas that wt(ca) takes two non-zero values w1 and w2 with frequencies \( A_{w_{1}} =p^{d-1}-1 \) and \( A_{w_{2}} =(p-1)p^{d-1} \) , respectively. Hence we get the weight enumerator of \( C_{D_{0}} \) . Note that for λ≠ 0 , η(−ρλ) = η(ρ) if \( -\lambda \in C_{0}^{(2,\,p)} \) and η(−ρλ) = −η(ρ) otherwise, so it is not hard to determine its complete weight enumerator from Lemma 9.

  2. (ii)

    When s is odd and ps , we have λ = 0 for all \( a\in \mathbb {F}_{p^{d}}^{*} \) and so all codewords ca , except the zero codeword, have the same weight w1 and the frequency is \( A_{w_{1}} =p^{d}-1 \) . Hence \( C_{D_{0}} \) has only one non-zero weight and its complete weight enumerator then follows from Lemma 9.

3.2.2 The second case that \(b \neq 0 \)

In this subsection, we assume that \( b\neq 0 \). By (3), Lemmas 6 and 7 again, it is easy to get the value of \( N_{a}(b,\rho ) \) for \( \rho \neq 0 \).

Lemma 10

For \( a\in \mathbb {F}_{p^{d}}^{*} \) , \( b \) and \( \rho \in \mathbb {F}_{p}^{*} \) , we have

$$N_{a}(b,\rho) = \left\{\begin{array}{lll} p^{e-2} && \textup{ if } s \textup{ is odd and } \lambda= 0,\\ p^{e-2} - \eta(b^{2}- \rho\lambda)p^{m-1} && \textup{ if } s \textup{ is odd and } \lambda \neq 0,\\ p^{e-2} && \textup{ if } s \textup{ is even and } \lambda= 0,\\ p^{e-2} - \eta(b^{2}- \rho\lambda)p^{m+d-1} && \textup{ if } s \textup{ is even and } \lambda \neq 0. \end{array} \right. $$

In order to evaluate \( N_{a}(b,0) \), we need one more lemma given below.

Lemma 11

Let \( b\) and \(\lambda \in \mathbb {F}_{p}^{*} \) . Then

$$\sum_{\rho \in \mathbb{F}_{p}^{*}} \eta(b^{2}-\rho\lambda) =-1. $$

Proof

Write \( p = 2h + 1 \) with a positive integer \( h \). For fixed \( \lambda \in \mathbb {F}_{p}^{*} \),

$$\eta(b^{2}-\rho\lambda) = \left\{\begin{array}{lll} 0 && \textup{ if } b^{2}-\rho\lambda= 0,\\ 1 && \textup{ if } b^{2}-\rho\lambda \in C_{0}^{(2,\,p)},\\ -1 && \textup{ if } b^{2}-\rho\lambda \in C_{1}^{(2,\,p)}. \end{array} \right. $$

Let \( d=b^{2}-\rho \lambda \). Then \( {\rho \lambda }/{d} + 1 = {b^{2}}/{d} \). According to Lemma 1, the number of \( \rho \in \mathbb {F}_{p}^{*}\) satisfying \( d \in C_{0}^{(2,\,p)} \) is

$$(0,0)^{(2,\,p)} + (1,0)^{(2,\,p)} = h-1. $$

Similarly, the number of \( \rho \in \mathbb {F}_{p}^{*}\) satisfying \( d \in C_{1}^{(2,\,p)} \) is

$$(0,1)^{(2,\,p)} + (1,1)^{(2,\,p)} = h. $$

It then follows that

$$\sum_{\rho \in \mathbb{F}_{p}^{*}} \eta(b^{2}-\rho\lambda) =(h-1)\cdot 1 + h\cdot (-1)=-1, $$

giving the desired conclusion.

The following lemma follows from (2), Lemmas 10 and 11.

Lemma 12

For \( a\in \mathbb {F}_{p^{d}}^{*} \) and \( b \in \mathbb {F}_{p}^{*} \) , we have

$$N_{a}(b,0) = \left\{\begin{array}{lll} p^{e-2} && \textup{ if } s \textup{ is odd and } \lambda= 0,\\ p^{e-2}- p^{m-1} && \textup{ if } s \textup{ is odd and } \lambda \neq 0,\\ p^{e-2} && \textup{ if } s \textup{ is even and } \lambda= 0,\\ p^{e-2}- p^{m+d-1} && \textup{ if } s \textup{ is even and } \lambda \neq 0. \end{array} \right. $$

Now we begin to prove Theorem 2.

Proof

Suppose that \( b \neq 0 \). By Lemmas 10 and 12, the proof is similar to that of Theorem 1 and so is omitted here.

4 Concluding remarks

In this paper, we employed exponential sums to present the complete weight enumerators and weight enumerators of the linear codes \( C_{D_{b}} \) in the two cases \( b = 0 \) and \( b \neq 0 \). As introduced in [28], any linear code over \( \mathbb {F}_{p} \) can be employed to construct secret sharing schemes with interesting access structures provided that

$$\frac{w_{min}}{w_{max}}>\frac{p-1}{p}, $$

where \(w_{min}\) and \(w_{max}\) denote the minimum and maximum non-zero weights in \(C_{D}\), respectively. Assume that \( p \nmid s \). It can be verified that the linear codes in Theorems 1 and 2 satisfy the property \( {w_{min}}/{w_{max}}>{(p-1)}/{p} \) if \( m>1 \) and \( s \equiv 1 \mod 2\), or if \( m>d + 1 \) and \( s \equiv 0 \mod 2\). We remark that the dimensions of the codes in this paper are small compared with their lengths and this makes them suitable for applications in secret sharing schemes with interesting access structures.