1. Introduction
In this modern era, the transmission of images over public networks is an indispensable task. Therefore, distributing secret images in a secure way is essential. Encryption schemes take plain-text data as an input and convert it into an unreadable form using secret keys. Then, an authorized person uses the secret keys to acquire the original data. Recently, S-box-based encryption algorithms have gained special attention [
1]. An S-box is used to create confusion; therefore, researchers are not only trying to improve the existing S-box schemes, but are also proposing new ones. Many authors (see, for example, [
2,
3]) have observed that the S-box used in the well-known cryptosystem, the advanced encryption standard (AES), is vulnerable because the AES cryptosystem uses a static S-box. Furthermore, it also has low algebraic complexity.
The role of an S-box is vital in a cryptosystem. Therefore, researchers are trying to generate S-boxes which are cryptographically secure. One way is to improve the security of the AES cryptosystem. That is why Cui and Cao [
4] enhanced the algebraic complexity of an AES S-box to make it secure against algebraic attacks. Similarly, Liu et al. [
5] proposed an improved AES S-box that has reliable security against algebraic and differential attacks. Tran et al. [
6] presented the Gray S-box for the AES, which is secure against algebraic and interpolation attacks. In addition to this, many other techniques are used to design S-boxes with the desired security. For example, Silva-Garcia et al. [
7] developed a novel chaos-based cryptosystem, which generates an S-box to resist linear attacks. Ibrahim and Alhabi [
1] used a Henon map to generate secure and dynamic S-boxes. Özkaynak [
8] proposed robust S-boxes using different chaotic systems. Due to their higher security, EC-based cryptosystems have gained the interest of researchers. Miller [
9] presented an EC-based cryptosystem with high security and a small key size. Cheon et al. [
10] used hyperelliptic curves to obtain a lower bound on the nonlinearity of Boolean functions. Hayat et al. [
11,
12] employed ECs over finite fields and rings to design secure S-boxes. It is analyzed that the S-box generators over finite rings generate dynamic S-boxes with reasonable time complexity.
Furthermore, the pixels have high correlation and the data size is large in an image. Therefore, to develop secure cryptosystems for the delivery of secret images is a common interest of researchers. Many techniques, such as fuzzy theory [
13] and chaotic maps [
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25], are used to develop encryption schemes.
Recently, chaos-based schemes have received more attention due to their easy implementation and fast execution [
26]. Similarly, chaotic maps have some unique characteristics, such as ergodicity, unpredictability, random behavior, and sensitivity to initial parameters, which are required for a good cryptosystem [
27]. Therefore, a number of image encryption schemes are proposed based on sine maps [
28,
29], cat maps [
30], and some other chaotic maps [
31]. Huang et al. [
32] developed an encryption scheme with better confusion-creation capability using the Rivest–Shamir–Adleman (RSA) algorithm and Arnold map. Similarly, Ye et al. [
33] designed an effective and secure image cryptosystem based on the RSA technique and a fractional-order chaotic system. On the other hand, there exist chaotic encryption schemes which are not secure. Chen et al. [
30] developed an image encryption algorithm using a 3D chaotic cat map, which has short period and hence, is vulnerable to the chosen plain-text attack [
34]. Similarly, the scheme developed by Sui et al. [
31] is based on logistic maps; however, logistic maps are insecure due to the small key space [
14].
Related work: Like chaotic maps, elliptic curves (ECs) are highly sensitive to the initial parameters, and a number of EC-based algorithms have been developed for cryptographic applications [
9,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48]. Zhang and Wang [
40] used the group law for the generation of a public key and encrypted digital images by combining a chaotic system and elliptic curve cryptography (ECC). Abdelfatah [
41] presented a digital signature scheme using the group law. Abbas et al. [
42] proposed a chaotic encryption algorithm using an addition operator over the points of the EC. El-Latif et al. [
49] developed an efficient encryption scheme using a cyclic EC and a generalized logistic map; basically, an EC-based sequence and a chaotic sequence are combined to generate a keystream for encryption. Toughi et al. [
50] generated a sequence of numbers using ECs, which are then used in the generation of keys to propose an encryption algorithm. Hayat et al. [
51] proposed a twofold image encryption scheme. Firstly, a plain image is masked by EC-based random numbers, and then permuted by an S-box generated using an EC. Reyad et al. [
52] modulated random sequences using ECs and chaotic maps. It is experimentally proved that all the above schemes are highly secure. In addition, ECs provide more security to a cryptosystem than chaotic maps [
53,
54], but it is important to mention that the scheme in [
49] first generates a sequence of scalars. Each scalar is then mapped to a scalar multiple of a point of a cyclic EC. To compute a scalar multiple of a point lying on an EC is not simple; it involves the group law, consisting of many complex calculations. Similarly, the scheme in [
52] also uses group operations to generate random numbers from the points of ECs. Thus, the schemes of [
4041,
42,
44,
49,
52] are time-consuming due to the use of the group law. The scheme in [
51] avoids the group law to generate ECs, but each plain image requires the generation of two ECs. Moreover, trials are required for the generation of ECs to ensure the encryption of an image because the said scheme does not output an S-box for all parameters. These facts slow the execution time of the scheme. The algorithm in [
37] does not generate triads for all images of the same size, but generates an EC for each image, which enhances the execution time.
In all the above-discussed EC-based schemes, finite fields are used to obtain the desired security. The security of such cryptosystems based on ECs over finite fields essentially depends on the computational cost for solving the discrete logarithm problem [
55]. Recently, Diaz et al. [
55] pointed out that the cryptosystems based on ECs over finite rings are more secure as compared to the cryptosystems based on ECs over finite fields. Their claim follows from the fact that the computational cost of breaking such cryptosystems based on ECs over finite rings depends on solving the factorization problem [
56] and the discrete logarithm problem. Our research contribution aims to develop a cryptosystem that is based on a ring of integers and that has higher resistance against modern attacks than the existing schemes of ECs over finite fields. In this work, we propose:
The current work is novel in the sense that:
It is based on a ring of integers rather than on a finite field;
It avoids the traditional way (group law) of generating an EC. Furthermore, it imposes a bound on the
y-coordinate of the EC, which is not the case in [
12,
51], and one does not have to check all the possible values over the underlying structure. So, the current S-box generator is comparatively efficient for a possible S-box;
It generates cryptographically strong S-boxes;
The time complexity of the proposed scheme is dependent on the chosen bound on the y-coordinate of the EC;
Unlike the case in [
37,
51,
57], each input image does not need the computation of a new EC for the confusion phase;
It can encrypt a number of images with better security against differential, statistical, key and plain-text attacks;
The run-time of the proposed scheme to encrypt color images is very low.
The rest of the paper is organized as follows:
Section 2 contains the related notions of ECs. In
Section 3, the proposed S-box algorithm and its analysis is described. In
Section 4, the proposed image encryption scheme is presented. In
Section 5, the decryption of the proposed scheme is reported. The security analysis is conducted in
Section 6. An application of the proposed scheme to color images is shown in
Section 7. Lastly, the conclusion is drawn in
Section 8.
2. Related Notions of ECs
Let
be a set of primes for any indexing set
. Then, for
,
is a composite integer and, hence,
is a ring. As for each prime
p,
represents a finite field. Thus, for primes
, we say that
is a finite field related to the ring
. For any two integers,
, with the condition that
, the EC
represents the set of points
, where
∞ is the neutral point lying at each vertical line passing through the EC, and
is the discriminant of
. The condition on the discriminant is imposed so that the EC
has no singular point. The integers
and
b are known as the parameters of
. For
, the ECs are known as Mordell elliptic curves (MECs); we denote them by
, and
denotes the number of points on the MEC
. There is a bijection [
56] between
and
, which maps
to
Consequently, an EC
may be deduced from
by mapping
to
and, hence, for each
we have a surjective map from
to
. Let
and
represent the former bijective and surjective maps, respectively; then, mathematically,
f and
g are given by:
The MECs play an important role in cryptography. Azam et al. [
58] defined different total orders, named as natural ordering (
) and diffusion ordering (
), on the points of MECs. For details, the readers are referred to [
58].
3. The Proposed S-Box and Its Analysis
The proposed encryption scheme in
Section 4 requires an S-box generator to obtain the desired level of confusion. For the construction of an S-box, we need the parameters
, and
t. It is mentioned that
, where each
is a prime and
k is a positive integer. In principle,
n may be assigned any value. We choose
n as a product of primes because, in the masking phase for each prime
, we need the EC over the related prime field
. The parameters
are used to generate the EC
over the ring of integers
, where
t is used as an upper bound on the
y-coordinate of the EC
. Here, upper bound
t means that we compute such
for which
. The
y-coordinate is kept bounded, so that we compute
for all
and particular values of
y instead of all
. This is conducted in order to reduce the time of execution. After the generation of the EC
, the points of
need to be arranged by some ordering. The points may be arranged according to any ordering, but the ordering
is capable of generating S-boxes with high cryptographic properties. Therefore, we use
to sort the points of
. Then, we construct an
S-box
by extracting the first
different values
of the
y-coordinate of the ordered
. Mathematically, the S-box is generated according to the following function:
defined by:
where
for some
and
for
. The S-box construction is clearly described in the following steps: stepsenumerate1
- Step 1.
To generate an S-box, select three integers , and t such that and ;
- Step 2.
Choose primes for a finite in such a way that ;
- Step 3.
For each and , compute all the points such that ; i.e., compute ;
- Step 1.
If the set is contained in the y-coordinates of the points , then proceed to Step 5. Otherwise, change for some i and repeat Steps 1–3;
- Step 5.
Arrange the points of by applying the ordering ;
- Step 6.
Construct the S-box , such that , where for some with the constraint that and for .
For parameters
, and
, an
S-box generated by the proposed method on an EC
is shown in
Table 1.
3.1. Analysis of the Proposed S-Box
The cryptographic strength of the proposed S-box is analyzed by well-known tests, which are described as follows.
3.1.1. Linear Attacks
A cryptosystem is secure if it can strongly resist attackers to exploit the linear relations of inputs and outputs. The immunity of an
S-box
S against linear attacks is evaluated by its non-linearity NL(
S) [
59], linear approximation probability LAP(
S) [
60], and algebraic complexity AC(
S) [
61].
For a chosen
n, the NL(
S) represents the minimum Hamming distances between the S-box
S and all the corresponding affine functions. Similarly, the LAP(
S) is the approximation of the relation lying between the inputs and outputs, and the AC(
S) represents the number of non-zero terms in the polynomial representation of the S-box
S. Mathematically, the NL(
S) and LAP(
S) are computed by Equations (
1) and
(2), respectively:
where
, and “· ”denotes the dot product. The resistance to linear attacks is greater if the NL(
S) is close to
, the LAP(
S) is low, and the AC(
S) tends to
. The values of the NL, LAP, and AC for the S-box shown in
Table 1 are
, and 254, respectively. Moreover, from
Table 2, it follows that the NL of the proposed S-box is greater than those of [
51,
62,
63,
64,
65,
66] and equal to NL of the S-boxes in [
8,
12,
37,
48,
58]. Similarly, the LAP of the new S-box is less than the LAP of the S-boxes in [
8,
12,
37,
48,
51,
58,
62,
63,
64,
65,
66]. The AC of the presented S-box is greater than the AC of the S-boxes proposed in [
51,
58,
64,
65] and equal to that of the S-boxes [
37,
62,
63,
66]. From the above discussion, it is obvious that the proposed S-box is highly secure against linear attacks, compared to the S-boxes in [
37,
51,
58,
62,
63,
64,
65,
66], while the security of the proposed S-box against linear attacks is comparable with the S-boxes in [
8,
12,
48].
3.1.2. Differential Attacks
Differential attacks are used to study the differences of outputs for the corresponding differences of inputs to obtain useful information. For an S-box
S, the differential approximation probability DAP(
S) [
67] measures the strength of
S to thwart the differential attackers. The mathematical representation of DAP
is given by:
where
, and “⊕” stands for the bit-wise addition in
. Thus, the S-box
S possesses higher security if the DAP(
S) is close to
. The DAP value of the S-box depicted in
Table 1 is
. From
Table 2, it is also evident that the DAP value of the proposed S-box is equal to the DAP values of the S-boxes displayed in [
12,
65,
66], and comparable to the DAP of the S-boxes in [
8,
37,
48,
51,
58,
62,
63,
64]. Thus, the strength of the presented S-box against differential attacks is comparable to strength of the S-boxes in [
8,
12,
37,
48,
51,
58,
62,
63,
64,
65,
66].
3.1.3. Analysis of Boolean Functions
The Boolean functions of an S-box are used to create confusion/diffusion in a cryptosystem. Two approaches, strict avalanche criterion (SAC) [
68] and bit independence criterion (BIC) [
68], are used to analyze the Boolean functions. The SAC calculates the change that occurred in the output bits due to the inversion of one bit in a set of input bits. The BIC determines the dependence level of a pair of output bits on inverting an input bit. For an
S-box
S, two matrices,
and
, compute the SAC(
S) and the BIC(
S), respectively:
where
represents the number of non-zero symbols in
y,
with
, and
denotes the
i-th Boolean function of the S-box
S. An S-box creates enough confusion/diffusion if all off-diagonal entries of
and
are close to
. The minimum (SAC (min)) and maximum (SAC (max)) of the off-diagonal values of
for the
S displayed in
Table 1 are
and
, respectively. Furthermore, it follows from
Table 2 that the SAC (min) value of the designed S-box is greater than the SAC (min) values of the S-boxes designed in [
8,
37,
58], and that the SAC (max) value of the new S-box is less than or equal to that of the S-boxes in [
8,
12,
37,
58]. So, the confusion-creation capability of the S-box in
Table 1 is greater than that of the S-boxes in [
8,
37,
58]. The SAC (min) value of the presented S-box is equal to the SAC (min) values of the S-boxes in [
12,
62,
65], and the SAC (max) value is less than that of the S-boxes in [
12,
62,
65]. This reveals that the proposed scheme generates S-boxes with higher confusion than the schemes in [
12,
62,
65]. The SAC values indicate that the confusion-creation capability of the new S-box is equal to the S-box in [
51] and comparable to that of [
48,
66]. Now, the minimum (BIC (min)) and maximum (BIC (max)) of the off-diagonal values of
for
S in
Table 1 are
and
, respectively.
Table 2 reveals that the BIC (min) of the proposed S-box is comparable with that of the S-boxes in [
8,
12,
37,
48,
51,
58,
62,
63,
64,
65,
66], and the BIC (max) value of the current S-box is less than that of the S-boxes in [
8,
12,
48,
51,
64,
65,
66]. Thus, the proposed scheme generates S-boxes with diffusion-creation capabilities comparable to the S-boxes in [
8,
12,
37,
48,
51,
58,
62,
63,
64,
65,
66].
4. The Proposed Encryption Scheme
Suppose we want to encrypt an image I of size over the symbol set , and represents the pixel lying at the intersection of the i-th row and the j-th column. Furthermore, let denote the sum of all pixel values of I. Then, the proposed encryption scheme consists of the following steps.
4.1. Generation of Keys
To encrypt an image of size
, we need to generate an EC
, over a ring
, for
. For the sake of convenience, we take
and
, so that we choose primes
and integers
to generate
. Thus,
and
t are chosen in such a way that there exists at least
points
, where
y is attaining each value in the interval
. This condition is imposed to ensure the generation of an S-box using points of the EC
. We further choose an integer value
as a key. The use of the key
is explained in
Section 4.4(i). The parameters
, and
are all secret keys.
4.2. Masking Phase
Before masking an image I, we first arrange the points of the EC according to the ordering . After ordering, we assume that stands for the i-th point of the EC . The reason for this is that the diffuses the y-coordinates of the points lying on an EC, because, over a ring of integers , if , then, for such an x, there are at least two values of y in , such that . The masking phase of an image I takes place as follows:
- (i)
Generate a row matrix
M from
of length
such that, for
, we have:
The purpose of constructing matrix M is to design a sequence from both coordinates of . The elements of the said sequence are used to hide the pixel values of an image I;
- (ii)
Choose a submatrix
N, which consists of the first
entries of the matrix
M because only the
values are needed to hide the pixel values. The chosen
n should not be less than
; otherwise, in
Section 4.3(i), the construction of
with size
will not be possible;
- (iii)
The sensitivity to the plain image is necessary for a secure cryptosystem. For this purpose, transform the entries of
N by the pixel value
to obtain the matrix
B, given by:
There is no restrictions on pixel or the number of pixels. Any number of arbitrary pixels may be used for transformation. For the sake of convenience, only one pixel value is fixed;
- (iv)
For the sake of simplicity, reshape the matrix B to construct a matrix with u rows and v columns. By reshaping B, we mean that B is divided into v blocks such that each block contains u entries and the i-th block represents the i-th column of the matrix B, so that the corresponding values of both B and I are combined to hide the pixel values of the image I;
- (v)
To obtain the masked image
, mask the pixels of image
I using Equation (
7):
Since there is a one–one correspondence between
and
,
may be mapped onto
and
, respectively, via the following maps:
These two ECs, and , are used to alter the pixels of an image. The S-box generated on is used to create the confusion in the encrypted image. The steps of the said procedure are explained in the following phase.
4.3. Diffusion Phase
The steps of this phase are explained as follows:
- (i)
For
, construct two row matrices,
, due to the all points
for both primes
, respectively, such that:
and:
In fact, we want to generate two sequences using ECs
and
. Both sequences consist of integer values, which are further used to alter the pixel values of the masked image
in
Section 4.3(v) and to permute the image
P in
Section 4.4(iii), respectively;
- (ii)
Take submatrices containing the first entries of , respectively, so as to choose the sequences of length that are equal to that of the number of pixels in the image I;
- (iii)
Modify the sizes of above constructed matrices, so that has u rows and v columns. The reason for generating such matrices has been explained previously;
- (iv)
Apply the modulo operator to to generate the matrices , consisting of m-bit integers. Since for encrypting m-bit images, m-bit sequences are needed;
- (v)
Convert the elements of
and
into the binary format and generate the image
by diffusing the pixels of
by the following equation:
where ⊕ is a logical operator (XOR operation by binary bit) known as exclusive disjunction.
4.4. Confusion Phase
For a secure cryptographic algorithm, it is necessary to have a desired level of confusion. For the current cryptosystem, the confusion phase consists of the following steps:
- (i)
Choose a secret key to construct a shifting parameter , such that ; then, give a circular shift to the S-box to design a new S-box . The shifting parameter, the secret key , and are linked in order to enhance the sensitivity to the plain image I;
- (ii)
Permute the pixels of the image
using the S-box
as follows:
In the coming encryption of a hypothetical image, the first entry of is 2. Then, represents the third entry of the S-box , which is 1. That is, stands for the -th element of the S-box ;
- (iii)
In order to obtain the scrambled image
, repeat
Section 4.3(v) using
P in place of
, and replacing
with
, such that:
- (iv)
Finally, to obtain the encrypted image
C with the desired level of confusion, permute the image
as follows:
The flowchart of the proposed encryption scheme is shown in
Figure 1.
We theoretically derive the time complexity of the proposed scheme in Theorem 1.
Theorem 1. Let I be a plain image of size , and let be a positive integer; then, the time complexity of the proposed scheme is , where is an integer such that is computed for all and .
Proof. In the key generation phase (
Section 4.1), to compute all
, we need to check for each
,
t values of
, such that
. Thus, the computation of
takes
time. Further, the ordering of the points of the EC
needs
time. In
Section 4.2(i), we can see that
; therefore,
M can be constructed in
time. As
, we can design
by a for loop, executing
times. Furthermore,
B can be reshaped by two nested loops, such that one loop executes
u times, while the other executes
v times. In a similar way, we can add two matrices of the same order by two nested loops. Thus, the time complexity of
Section 4.2(ii)–(v) is
. From the chosen keys, we have
and
, so that the complexity of the masking phase is
Now, we can map the EC
on the ECs
in
time. In the diffusion phase (
Section 4.3(i)),
and
for
. Therefore,
Section 4.3(i)–(v) takes
and
time, respectively.
In the confusion phase (
Section 4.4(i)), the time required to compute
is
and
can be computed in constant time. Since
has
entries, we can implement
Section 4.4(ii)–(iv) in
time, using two nested loops executing
u and
v times, respectively.
Clearly, and ; thus, the above discussion implies that the time complexity for the presented scheme is . □
As the time complexity is dependent on the parameter t, that is, the time is controllable with t, the current scheme is effective, particularly when a large dataset of images is to be encrypted.
The whole process is illustrated by the encryption of a 4-bit hypothetical image, as shown in
Figure 2.
7. An Application to Encryption of Color Images
In this section, we apply the proposed scheme to the color images. We encrypted images of Female
, Lena
, and San Francisco
using the parameters
, and
, where
I stands for the R (Red), G (Green), and B (Blue) components of an image, respectively. The plain and encrypted images of Female
, Lena
, and San Francisco
are shown in
Figure 11.
The NPCR and UACI results are computed by randomly changing a pixel value in each channel. It can be observed from
Table 8 that the NPCR and UACI results of each channel for the tested color images lie in the expected range. Similarly, the entropy results of the R, G, and B components also belong to the expected ranges for each of the color images.
The experimental results of the color Lena
are compared with the results of the schemes in [
7,
28,
29,
73,
74,
75,
76,
77,
78], as shown in
Table 9 and
Table 10.
The results in
Table 9 reveal that the NPCR values for the R, G, and B components of Lena
are greater than the theoretical value (
). Apart from this, the R component’s NPCR value is greater than the values of the schemes in [
29,
75], equal to that of [
7,
77], and comparable with [
28,
74,
76]. The NPCR value of the G plane is greater than all the NPCR results of to the schemes in [
7,
28,
29,
73,
74,
75,
76,
77]. Similarly, the NPCR results of the B component is better than the results of [
7,
28,
29,
74,
75,
76,
77,
78]. In addition, the average NPCR value resulting from the current scheme is greater than the NPCR results of all the listed schemes in
Table 9. The UACI results of the R, G, and B components of the current scheme lie in the expected range. Furthermore, the UACI results of the new scheme for all the three components are better than the results of the schemes in [
7,
73,
75,
78] and comparable to that of the schemes in [
28,
29,
74,
76,
77]. It follows that the proposed scheme is better in performance against the differential attacks than the schemes in [
7,
28,
70,
73,
74,
75,
76,
77,
78].
Table 10 reveals that the entropy value of the R component is greater than that in [
74,
75,
77] and equal to the values of [
76,
78]. The entropy value of the G component is also greater than that in [
74,
75,
77] and equal to the value of [
29]. Similarly, the entropy result of the B component is greater than the results of [
28,
29,
43,
73,
74,
75,
77,
78] and equal to that of [
7,
76]. In addition, the average entropy value resulting from the current scheme is better than that of the schemes in [
73,
74,
75,
77] and equal to that of the results of [
28,
29,
43,
76,
78]. This discussion indicates that the current scheme generates encrypted color images with higher randomness than the schemes in [
74,
75,
77], and the randomness of the encrypted images in current scheme and the schemes in [
29,
78] is comparable.
The histograms of the channels of the plain Lena
and the encrypted Lena
are shown in
Figure 12a–f, respectively.
Figure 12 confirms that the histograms of the encrypted channels are uniform and, hence, the presented scheme encrypts color images having high resistance against the statistical attacks.
In
Table 11, the correlation of the adjacent pixels of three different encrypted images with different sizes is shown. It is evident that the proposed scheme encrypts any image in such a way that it weakens the correlation between two adjacent pixels of any channel.
Along with other properties, a good encryption scheme should be highly efficient. Different color images with different sizes are encrypted using the current scheme. To demonstrate the efficiency of the current scheme, the encryption times (sec) for the said three images are computed, since we use a pre-computed EC over the ring of integers as an input for all input images. While computing the encryption time, the time taken by the inputs is not taken under the consideration. The encryption time of the current scheme is compared with the time of some recent schemes [
28,
78,
79], as shown in
Figure 13. The results for the schemes in [
28,
78,
79] are available in
Table 3 of [
80].
For images of size
w = 256,512, the performance of our scheme is comparable with that of [
28], and for
, the new scheme is highly efficient, compared to the scheme of [
28]. Similarly, in
Figure 13, the plots of [
78,
79] are overlapping, but our scheme is more efficient than [
78,
79] for images of all sizes.
Thus, the presented scheme is capable of efficiently encrypting color images as well, and can be used for the good encryption of color images.