1. Introduction
In recent years, along with the digitalization of information, the field of cryptography has become more and more important, and the protection and encryption of documents from public and private institutions must guarantee a high level of security. In [
1], the authors introduced a new algorithm for extending secure coding based on prime numbers coming from RSA by using Information Fusion techniques and fractals. As we will see below after the introduction, we will extend the results in [
1], and we will introduce two quantum properties, that is, the random evolution of the fragments of the key and the recombination of the fragment of the key to obtain a key that is resistant to quantum malicious attacks since the key becomes crypto-agile.
The CSPRNG (Cryptographically Secure Pseudo-Random Number Generator) uses techniques that generate random numbers suitable for cryptographic systems [
2]. In this work, we have developed a new algorithm for generating a highly random key based on concepts like fractals, the fractal nature of the sequence of prime numbers [
3], the RSA algorithm, and quantum security.
The idea of using fractals in cryptography is a relatively new idea that some researchers are exploring. Mathematical studies on fractals began in 1982 with Benoit Mandelbrot. He formalized this new type of geometry in his book [
4]. Mandelbrot sets are widely used for cryptographical purposes. The study in [
5] used a modified Mandelbrot set to generate a public key and a modified Julia set to generate a private key. Another study from 2020 used two Mandelbrot sets to create an encryption algorithm [
6]. A Mandelbrot set was also utilized in [
7] along with the Hilbert transformation to create a random encryption key. In 2019, an algorithm for encrypting images was proposed using two fractals: the Hilbert curve and the H-Tree [
8]. These fractals were used in this study to shuffle the pixel positions and their values in an image. There are also types of studies, like ours, that propose the application of different combined techniques to obtaining cryptographic algorithm, with the aim of optimizing their effectiveness. In one study, for example, two algorithms based on fractals and chaos theory are combined to obtain an encoded image [
9]. A 2023 work proposed the combination of the RSA algorithm, homomorphic cryptography, and chaotic maps to enhance image encryption [
10]. Another work from 2024 combined an E-fractal and a hash function to create a cryptographic key [
11]. Another recent article proposes the use of a 3D fractal cube and compressed sensing to create a compression encryption algorithm [
12].
The choice of using fractals is motivated by the inherently complex and chaotic structure of these geometric shapes [
13]. In fact, as is well known, a fractal F is a set that has the following properties:
Self-similarity: F is an object that is similar to one or more of its parts. Indeed, F is the union of a certain number of parts that reproduce the entire initial F when sufficiently enlarged.
Fine structure: F reveals details at every zoom.
Irregularity: F cannot be described as a set of points that satisfy simple geometrical or analytical rules.
Fractional dimension: A new dimension concept is defined for fractals, different from the classical conception; this new introduced dimension is called the “Hausdorff dimension” and is defined by a formula that uses the logarithms
with N equal to the number of parts into which the object can be divided and
s the scale factor.
These properties make the idea of applying fractals in the field of cryptography interesting [
14].
Another section of the algorithm concerns the generation of prime numbers. A relevant question in the field of mathematics in recent decades is that of the generation of primes and whether this can be represented by a deterministic scheme. In [
15], we showed that the prime numbers follow a multiscale distribution, meaning that they can be classified in terms of tree structures. In [
3], we showed that prime numbers can be seen as angles of a multifractal polygon based on a hexagon. All these results indicate that prime numbers follow a multiscale distribution and that starting from two sets (6k + 1 and 6k − 1) that contains all the prime numbers, we can generate other sets that are more likely to contain primes, and as we go down the decomposition hierarchy, the extent of the research decreases, and the computational time is also reduced.
Another feature that is guaranteed in the present work is quantum security, which makes the algorithm quantum-resistant. Quantum-resistant cryptography is cryptography that aims to create functions and protocols that allow the system to remain secure even if there is an attack from a CRQC (Cryptographically Relevant Quantum Computer), a quantum computer with features such that it can break public key cryptography systems, such as RSA [
16]. Large quantum computers would theoretically have the ability to break algorithms like RSA using Shor’s algorithm, a quantum algorithm that uses mathematical properties to efficiently factorize composite numbers into prime factors. The potential damage that CRQCs could inflict is motivating researchers in the field of cryptography to develop countermeasures, although at the moment, quantum computers are not so diffused [
17].
Therefore, this paper uses as a starting point the technique proposed in [
1] and extends it, likewise obtaining an algorithm for Information Fusion (IF) that is more efficient compared to that in the previous work. As is well known, Information Fusion is a relatively new research field, which is considered multidisciplinary and consists of taking data from more than one source and joining them together in order to obtain super-information. In the present work, thanks to our Information Fusion algorithm (IFA), we will obtain the following advantages:
A security key driven by a numeric sub-key obtained via a multiscale algorithm for prime generation;
A security sub-key based on different fractal algorithms;
A security key given by fusion of the information from the two sub-keys.
The sub-keys follow a new dynamic process of evolution and recombination that gives them a crypto-agile property in the context of quantum computing. Compared to the state of the art, this work is the first to pave the way for a new approach that simultaneously combines fractals, prime numbers, and a cooperative–competitive quantum mechanism involving both relocation and recomposition in key construction. This new approach endows the solution with intrinsic crypto-agility and thus specific resistance to quantum attacks.
2. Construction of the Fractal Sub-Key
The algorithm randomly chooses between six different fractal sets listed below:
A Cantor set;
A Sierpinski set;
A Mandelbrot set;
A Peano set;
A Barnsley set;
A Vicsek set.
The first four fractals were already used in the previous work [
1], while the last two are new additions. The addition of new fractals compared to the previous version aims to increase the randomization of the fractal component of the algorithm; moreover, while the choice of the fractal to use was human-driven in the previous solution, in this solution, the choice is made in a random and rolling mode.
In five of the six fractals listed above, the procedure for creating the number is using Iterated Function Systems (IFSs). An IFS fractal is a fractal generated by iterating a certain number of affine transformations. As is well known, an affine transformation in a plane is a biunivocal application that takes a point P of coordinates (x,y) and returns a point P’ of coordinates (X,Y) according to the following relation:
In an equivalent way, in the matrix representation, we can write
where
An affine transformation changes the position of a point in the plane. In this way, we can, for example, start from a geometrical figure and apply an affine transformation to every vertex of the figure, thus obtaining a translation, rotation, or distortion of the shape. In the case of the Mandelbrot set, we use a specific formula to generate points in the set. Let us show how the sub-key is created for every fractal.
2.1. Cantor Set
As usual, the construction of the Cantor set has the following procedure: We start from the [0, 1] interval, we divide it into three equal parts, and we delete the open middle third
In this way, we obtain the set
If we repeat the same procedure for these new two intervals, we obtain
and so on.
Cantor set is defined as the intersections of all the obtained values
in iterating through the procedure infinitely. The affine transformations that are used to generate the sub-key are the following:
A graphical representation of the process is shown in
Figure 1:
2.2. The Sierpinski Set
The Sierpinski set has already been explored for cryptographical purposes [
18]. It is constructed starting from an equilateral triangle. It is divided into four congruent triangles, and then the central one is eliminated. The procedure is repeated infinitely with the remaining triangles (see
Figure 2).
Sierpinski set is generated from its affine transformations:
2.3. The Mandelbrot Set
Benoit Mandelbrot developed a set that is one of the most known fractals, generated using a recursive formula on the complex plane
where c is a complex number, and it is in the Mandelbrot set if the succession does not tend to infinity. If we represent all the points in the complex plane, coloring all the points that belong to the set in black and the points that do not belong to the set with other colors, we obtain the Mandelbrot fractal, as shown in
Figure 3.
To generate points that belongs to the Mandelbrot fractal, the following procedure is used: We start from the principal formula for the cardioid of the Mandelbrot set. The representation of the cardioid in Cartesian coordinates is
This formula generates the points on the cardioid’s surface. Instead, we need to generate the points inside it. For this reason, we introduce a new parameter r, which varies from 0 to 1. Thus, we use a linear combination of two points: the origin (0,0) and a point on the surface of the cardioid. In this way, we can generate the points distributed inside the cardioid. The iterative procedure is the following:
An angle θ between 0 and 2π is chosen randomly;
A r parameter between 0 and 1 is chosen randomly to generate the points inside the cardioid;
The following formulas are used to determine the real and imaginary parts:
2.4. The Peano Set
The Peano curve also has already been used to create cryptographical algorithms [
19]. This curve was the first example of a space-filling curve ever discovered. It is constructed iteratively in various steps, where at every step, a set of squares and the sequence of the centers of the squares are constructed, as obtained from the precedent step. Visually, this situation is obtained as shown in
Figure 4.
The values of the Peano set are determined by iteratively repeating a set of nine affine transformations whose values are listed below in
Figure 5.
2.5. The Barnsley Set
The Barnsley fern is another example of a fractal created by an Iterated Function System. Visually, it is the following shape, as shown in
Figure 6.
Fractal confirms its statistical validity in generating random numbers [
20]. In a similar way to the majority of the fractals above, it has an affine transformation, which we use to generate random numbers on the plane. The expressions are as follows.
2.6. The Vicsek Set
The last fractal used by our algorithm that can be chosen to generate a fractal sub-key is the Vicsek snowflake, as shown in
Figure 7.
Affine transformations are the following:
3. A Multiscale Prime Generator Sub-Key
The other sub-key that we give as input to the quantum F&NIF algorithm is a product of primes that we obtain through the generation of two prime numbers, with each one generated thanks to a multiscale sieve, using the rules in [
21]. We randomly generate a number
n ∈ N, and the sieving algorithm will return either
n if it is prime or the prime number closest to
n. The sieving algorithm is based on an automated procedure based on a proved theorem in [
3], which asserts that each prime number can be written as the difference between the product of the first m primes and a prime obtained in the previous level of gridding. So, using a multiscale analysis, each prime number can be written as
where
k is the counting index,
is a prime number obtained at the level
m −
1,
j is the level of decomposition, and
the prime number obtained. So, the algorithm stores the candidate prime numbers useful for multiscale generation gradually, up to the nearest prime number of the input. Therefore, the key elements to the algorithm are the following:
is the product of the first
m primes that represents the multiscale level and is the basis for generating the prime candidates.
At each multiscale level, k can range from 1 to a value that changes at every level, and specifically, the last takes the value of that is the prime number that serves to generate the next multiscale level.
After obtaining the product between the multiscale level and k, we subtract , which is each prime number obtained at the previous multiscale level.
As shown in the recent work [
21], the multiscale algorithm proposed here is not only applicable but even more efficient than other sieves.
4. Overview of the Infrastructure
The system for obtaining the cryptographic key is composed of four components:
A fractal numerical algorithm for generating the fractal sub-key, which randomly chooses one of the fractals listed above;
The RSA algorithm for creating the numerical code and the private key, which serves in some of the processes in the F&NIF part, as we will see below;
A multiscale algorithm for generating another number, which is then concatenated to the fractal number;
The quantum F&NIF algorithm, which includes the mathematical operations on the matrices, transformation at a random time, and quantum security.
A diagram of the quantum F&NIF algorithm is shown in
Figure 8.
F&NIF algorithm takes three numerical vectors as its input: the first one is generated by the fractal algorithm; the other is the module, that is, the product of two primes
p and
q generated by the multiscale algorithm; and the third one is the private RSA key generated through execution of the RSA algorithm. The size of the first two vectors is selected automatically according to the following relation:
with
dim: The dimension of the new cryptographic key;
dimModule: The dimension of the RSA module’s sub-key;
dimFract: The dimension of the fractal sub-key.
The multiscale algorithm, as discussed above, consists of generating two prime numbers, the product of which is then concatenated to the fractal number to obtain one single number. So, the algorithm consists of a procedure that is repeated twice, once for each prime number. In the introduction, we explained that this procedure is based on the findings described in the previous section, and the primes generated belong to a particular set, which is determined by the multiscale level, the alpha number, and k. Below is an image of how a multiscale hierarchy is created using the rules in [
3], and this was presented in the previous section (see
Figure 9).
At this point, we have all the necessary ingredients to implement the new quantum F&NIF algorithm:
The first step is to concatenate the product of the primes and the fractal number. For simplicity, we call this new obtained number “hybrid”. Now, we need to arrange the hybrid number into a squared matrix. The dimension of the matrix is determined by finding the next square number from the number of digits of the hybrid. So, if, for example, the hybrid has a dimension 14, the matrix has a dimension 16. Now, we need to add the remaining padding elements at the end of the matrix, and their values are selected in this way: We travel through the RSA private key, and the digits that we find, one at a time, represent the index of the element of the hybrid that we add. So, in a programmatic way, if the first digit of the RSA private key is 2, then, the element hybrid [
2], so the second digit of the hybrid, is added in a padding position. This is conducted until the padding elements are exhausted. By considering
a ∈ Z
m and
b ∈ Z
n as the two vectors representing the multiscale sub-key and the fractal sub-key, and l ∈ Z as
the number of padding elements
p in the matrix is calculated as
where
dim is the dimension of the matrix, obtained from the next square number mentioned above, and so two cases can be distinguished:
Consequently, the number of rows of the matrix is
Then, we construct another matrix, a permutation matrix. A permutation matrix is a matrix that is obtained by swapping some rows or columns in the identity matrix. The matrix thus must be composed of all zeros and a one in every row in different positions. In our algorithm, this matrix is constructed from the RSA private key; by scanning one digit at time, this represents the index at which the one is positioned in the row. Since the private key is composed of equal digits, we perform two controls on the private key before constructing the matrix: the first is to make sure that the length of the key is at least equal to the number of rows/columns in the matrix. In the second, we verify whether there are equal elements in the key. This because the ones that we position in the matrix must all have different positions; otherwise, the matrix will no longer be an identity matrix with some rows/columns changed. If we find numbers that are already present in the key, we substitute them with a number generated randomly that is not present. After constructing the permutation matrix, we multiply the hybrid matrix and the permutation matrix.
The algorithm then continues on to the quantum security part, which we anticipated in the introduction. The technique used to guarantee this property regards operations inside the newly obtained product matrix, and it draws inspiration from quantum mechanics, specifically the scattering theory. The technique consists of creating two fragments of matrix digits of a certain length and “colliding” them to create two new fragments, mixing the digits in them. In this case, the crypto-agility consists of dynamically evolving each fragment, which means that at different times, the fragment will be in a different position from its initial allocation. For each fragment created and at every moment the daemon is free from a task, it takes two fragments,
FrA and
FrB, which have two contents,
Ca and
Cb, and gives as output two new fragments
FrC and
FrD with contents
Cc and
Cd.
Figure 10 shows this interaction.
The algorithm we used randomly chooses one of these two operations: the first is swapping rows m and m + 1 in the matrix, with m randomly chosen at each specific time; the second is taking rows m and m + 1 with m randomly chosen and subdividing them into specific amounts of the total, for example, 30% and the 70% of the digits. So, we obtain four fragments, which we collide two at a time; mix the content; and recombine them with a cross-shifting operation, where the first 70% of the row m is merged with 30% of the row m + 1 and 70% of the row m + 1 is merged with 30% of the row m. Finally, we unite, row by row, the matrix digits, obtaining the new cryptographic key.