Using Algebraic Fractals in Steganography

Steganography is a technology for hiding watermarks inside media files, which is relevant in the field of copyright protection, secret communication, etc. The effec-tiveness of modern methods of digital image processing allows determining the presence of embedded watermarks in a stegoimage using the original image and its statistical characteristics, as well as a priori information about the method and algorithm of embedding. In contrast to the known approaches, it is proposed to use algebraic fractals for steganographic embedding of watermarks in color images. It is proposed to use algebraic fractals in the form of medium cover image acting as a secret key, which allows the embedding to be more resistant to computer attacks, including JPEG compression. The main advantage of such use of fractals is an increase in the level of secrecy in which the attacker must know the parameters of the fractal image. Without knowledge of these parameters, it will not be enough to have the original stegoimage and a priori information about the embedding method to extract secret data. This chapter analyzes the methods and provides examples of generating algebraic fractals in the form of the Julia set using the escape time algorithm.


Introduction
The digital form of audio, image, and video has become a commercial standard in the past decade. Digitized multimedia files can be easily created, copied, processed, saved, and distributed using commercial and free software. Unfortunately, the digitization of multimedia files leads to the fact that these files are subject to digital piracy: illegal copying, use, and distribution of copyrighted digital data. In order to combat digital piracy, various copyright protection mechanisms have been developed for many years. However, most of these mechanisms were found to be erroneous and unsafe.
One of the tools to protect multimedia data from copyright infringement is digital watermarks. Into digital watermarks, an imperceptible "mark" signal is embedded in the original image. This label uniquely identifies the owner. After embedding the watermark in the original image (container) there should be no noticeable distortion. Embedded watermarks should not be removed by an incomplete person and must be resistant to intentional and unintentional attacks.
One of the ways to protect copyright, which currently exists, is steganography, the art of hiding information in electronic media. Methods of steganography vary in their approach to hiding information. As a rule, the hidden data in electronic means will change some of their properties, which can lead to degradation or unusual characteristics.
The paper deals with the introduction of watermark into a still color image of JPEG format using steganography methods. A feature of the proposed method is the use of a fractal image as a secret key, in which a two-dimensional fractal of algebraic type in the form of a Julia set is used. As a result, an evil intentional person will not be able to generate an identical fractal image without the exact value of a certain complex number, which is agreed in advance between the sender and the recipient, which makes the proposed method resistant to attacks.
Algorithms for creating a fractal image are considered, into which a digital watermark is then embedded.
To embed the fractal image in the container, the algorithm that performs a three-level expansion using the Haar transform was chosen and implemented in the MATLAB. In order to optimize the quality of extraction and the amount of embedded information, an algorithm for calculating thresholds has been proposed, with the help of which the necessary number of wavelet decomposition coefficients suitable for embedding has been selected.
To assess the possibility of detecting the fact of embedding the watermark in the stegoimage, the method of estimating the fractal dimension (FR) can be used before and after the mark has been embedded. With numerous examples of parameters of algebraic fractals and the hidden algorithms used, it is shown that the introduction of a watermark slightly changes the fractal dimension of the stegoimage, which corresponds to the high stability of the method to possible steganographic attacks.
To assess the quality of the results obtained, the quality was estimated based on the following metrics: mean square error (MSE) and signal-to-noise ratio (SNR), expressed in decibels. The results of the original container and the container in which the watermark with the key in the form of a fractal are embedded, as well as the original and extracted watermark, are given.
Analysis of the results of the quality assessment of the original container and the container with the embedded watermark and the key in the form of a fractal, as well as the original and extracted watermark showed that the proposed algorithm provides a high quality of hiding confidential information.

Algorithm development and software implementation of the generation of a fractal image of Julia set
The fractal image of a Julia sets will form using an algorithm of time escape (Escape time algorithm) [1,2]. The algorithm is based on the use of complex maps when one complex number z n ¼ x n þ iy n is matched by another complex number z nþ1 ¼ x nþ1 þ iy nþ1 according to the iterative rule z nþ1 ¼ f z n ð Þ, where f(z) is some nonlinear function of the argument z, and n is the iteration number.
The algorithm uses a quadratic complex polynomial: f z ð Þ ¼ z 2 þ c where c ¼ x þ iy is the starting point on the complex plane on the basis of which the Julia set is constructed.
If point c belongs to the Mandelbrot set, the Julia set constructed on it is connected [3]. If c does not belong to the Mandelbrot set, the constructed sets are scattered into an infinite number of isolated points (Fatu dust). If the point c lies near the boundary of the Mandelbrot set, such sets form fractal figures figuratively called the "seahorse valley" in the vicinity of zo = 0, which have the property of self-similarity with chaotic dynamics.
Thus, the algorithm for constructing the Julia set takes the form of [4]: 2. Calculate the radius R for a given polynomial f z ð Þ ¼ z 2 þ c; 3. Select the maxstep parameter to indicate the maximum iteration. The higher it is, the higher the accuracy and the slower the algorithm; 4. Generate an array of colors from less bright to brighter. We will denote the color dependence of the removal of points from a variety of Julia sets; 5. For each point, we calculate whether it is part of the filled Julia set or not, as well as the iteration number at which the threshold has exceeded. If |z| > R then use the first color, then use the color palette on which the iteration number was exceeded a threshold.
The implementation of the algorithm begins with the construction of the rectangle L Â L, within which the Julia set will be constructed. By changing its parameters, we can "bring closer" the concentrations of interest to a set with high accuracy. The resulting rectangle is divided into parts with coordinates z i,j depending on the number of pixels of the image M Â M.
Each point z i,j enters an iterative loop f z ð Þ ¼ z 2 þ c. The number of iterations depends on the maxstep parameter. If after a given number of iterations a point does not go to infinity, then such a point belongs to the Julia set.
Depending on which area of the Julia set will be generated (L Â L), a certain number of points will go to infinity, without reaching the maximum iteration.
To optimize the algorithm and significantly reduce the generation time of the Julia set, the following approach was adopted: for a complex number, the radius is calculated, and at each iteration, the test z i,j > R occurs, for points satisfying this condition, iterations are no longer performed.
The points z i,j extending beyond this radius will go to infinity through a certain number of iterations; since their attractor is an infinitely distant point (points z i,j > R enter the pool of the attractor A (∞)). The basin of an attractor of a point z of a function f is a subset of points from a neighborhood of z (denoted as A (z)), that any trajectory starting at one of these points converges to a point z.
Such an approach can significantly reduce the number of calculations, especially with the general form of the Julia set (2 Â 2). However, with an increase in the approximation to the level (0.005 Â 0.005) the number of calculations will tend to the initial ones, as more and more points will belong to the Julia Set. The color in the implementation of the algorithm was chosen so that the absolute red color (with a brightness level of 255) has points (belonging to the Julia set) that do not go to infinity with the maximum number of iterations maxstep. The brightness of the "red component" of the rest of the check depends on the number of iterations that the point passed, going to infinity (points not belonging to the Julia set, but rather close to its boundary). For the green channel, an inverse relationship was used: the smaller the iterations, the greater the brightness of the green component up to the level of 255, if the point was originally outside the radius. The blue channel changes depending on the distance of the point from the origin and is minimal at z = 0.
The results of the developed program module are presented in Figure 1.

Embedding a watermark in a stegoimage using a "fractal key"
The created fractal image based on Julia's set can be used as an intermediate cover image (key) for embedding a digital watermark into it by one of the wellknown methods [5][6][7]. So, for example, when using the least significant bit method when embedding, a fractal is converted into a one-dimensional binary array and every eighth bit of the given array (that is, every least significant bit of the next fractal byte) is replaced with a watermark bit.
After the watermark is fully integrated into the created fractal image, the step of embedding the filled fractal key into the original image begins [8][9][10].
As an example, consider embedding a watermark in a container using a 2D wavelet algorithm. To embed a watermark (in our case, a fractal image containing a watermark) in a cover image using 2D fiberboard, the algorithm [11][12][13] was used as a basis, which uses a three-level wavelet decomposition using the Haar transform. The decomposition of the container in the area of coefficients of detail of the first level LH1, HH1, HL1 is as follows: A horizontal Haar transform is applied (across all rows) to the source container (Eqs. (1) and (2)).
In Eqs. (1) and (2), the following notation is used: Сont is an array of pixels of the original image; C1 is the half-sum matrix of pixels in the original image; C2 is the half-difference matrix of the pixels of the original image; M is the number of rows of the original image; and N is the number of columns of the original image.
The resulting matrices C1 and C2 will have the same dimension [i, jj], which means that the number of columns will be two times less relative to the Сont matrix of the original image. Then, using the values of the matrices C1 and C2, we calculate the coefficients of approximation (LL1) and details (HL1, LH1, HH1) for level 1 of the decomposition. The arrays of coefficients of approximation and detailing of level 1 obtained using 2D DVP have the same dimension [ii, jj], which means that each of these arrays is two times smaller than the array of the original image.
To get the arrays of coefficients for the second level of decomposition: LL2, HL2, LH2, HH2, you need to perform similar actions, while taking the array of approximation coefficients LL1 obtained at the first level of decomposition for the original image.
At each decomposition level, coefficients exceeding the threshold values are selected. The threshold T i for the decomposition of level i depends on the maximum absolute coefficient C i over all ranges of coefficients of level i, thus [14]: The watermark is embedded in all coefficients exceeding the threshold value T i for the corresponding decomposition level obtained from Eq. (7). Used additive algorithm for embedding watermark: where v 0 i x, y ð Þ is a modified coefficient with coordinates (x, y); v i x, y ð Þ is a coefficient chosen for implementation with coordinates (x, y), for example, for level 1: LH1 (x, y), HH1 (x, y), HL1 (x, y)); x i x, y ð Þ-bit of watermark with coordinates (x, y); α-the scaling factor is adjusted for each level of decomposition. So for the range of coefficients of approximation of the third level α = 0.02, since the coefficients of this range have large values. Scaling factors of 0.1, 0.2, and 0.4 are used for the third, second, and first levels of decomposition, respectively. The fractal image is first embedded in the wavelet coefficients of the third level, then, if the coefficients of the third level were not enough to fully embed the watermark, the coefficients of the second level are used, etc. To extract the watermark, the inverse of the implementation equation (Eq. (9)) is used, but the adaptive-level scale factor α is taken into account.
A fractal image, in which a watermark is embedded, acts as a watermark. Figure 2a shows the original unfilled image with a size of 6400 Â 4096 pixels in JPEG format. The image containing the embedded key is shown in Figure 2b. Figure 3 shows the results of extracting the secret fractal key from the filled image. Figure 3a shows the original fractal image, in Figure 3b is the image obtained after extraction.    Figure 4 shows the results of extracting a digital watermark from the selected fractal. Figure 4a contains the original watermark and Figure 4b shows watermark extracted from the key.

Experimental results
As a result of the algorithm, a watermark was extracted with high quality. Despite the fact that you can observe small pixel distortions in the extracted secret key, the received watermark as a QR code is completely identical to the original one.

Evaluation of the quality of the algorithm
The quality assessment of the visual distortion of the fractal cover image was performed on the basis of the following metrics: normalized mean square error (NMSE) and peak signal-to-noise ratio (PSNR) (Eqs. (10) and (11)): In the relations presented, C x,y denotes a pixel with the coordinates (x, y) of the empty cover image, and S x,y denotes the corresponding pixel of the filled image.
The calculation of the metrics was carried out with different sizes of the implemented secret key and digital watermark. The results are presented in Table 1.
To assess the secrecy of the developed system, a situation was simulated in which the attacker took possession of a secret key with an embedded watermark, and he also knows some parameters of the generated fractal, namely, the size of the rectangle l, the maximum number of iterations k and the image size m. The only unknown parameter is the starting point c. As an example, four fractals were generated with different values of the parameter c ( Figure 5) and the watermark was extracted using the obtained images and the secret key containing the watermark presented in Figure 4b.
The results of the extraction of watermark are shown in Figure 6.
As can be seen from the figures, all the images obtained as a result of the experiment are so significantly different from the original OT. As a result, the extraction of information from the QR code becomes impossible. From the experiment, it is clear that to obtain the information it is necessary to know the parameters of the fractal key with high accuracy. The developed method makes it possible to reduce the probability of the substitution or theft of secret information in similar steganographic systems to almost zero.

Size of watermark, pixels
Fractal

Analysis of the possibility of steganalysis by measuring the fractal dimension of the secret key before and after embedding
The importance of steganographic watermark embedding is their steganographic attacks resistance. In this case, the problem arises of detecting the very fact of the introduction of the watermark into the cover image. For this purpose, the method of estimating the fractal dimension of the image before and after embedding the watermark can be used. Consider the problem of measuring the fractal dimension of color or black and white images after embedding the watermark into them [15].
As is known, a fractal is defined as a collection of objects for which the Hausdorff dimension is strictly greater than the topological dimension. The concept of self-similarity is used to estimate the fractal dimension.
A bounded fractal set in a Euclidean n-space will be self-similar if it is a union of different N (disjoint) reduced copies that can be scaled using a special scaling factor r. In accordance with the entered scaling factor, the fractal dimension D of set A can be obtained using Eq. (12).
where N is the total number of boxes L needed to cover the fractal set; 1/r is the scaling factor of the box in relation to the image.
As a result, D is a dimension relative to the size of the box used to measure the fractal image. It can be said that the fractal dimension is a measure of how "complex" a self-similar figure is.
Let us consider the two most common methods for measuring dimension: differential box-counting and triangulation method.  The differential box-counting (DBC) method takes into account the difference between the maximum and minimum intensity values of the brightness of the image. Let an image be given with the size M Â M, which is divided into "boxes" with the size L Â L Â L 0 (Figure 7). The height of the box L 0 divides the third coordinate of the image, which is the intensity value.
Space (x, y) of the image containing the values of the coordinates of the peakmudflows is divided into cells of size L Â L, after which the maximum and minimum intensity values of (i, j) cell equal to l and k are found, respectively. The next step for each cell is the sum of the differences between the values found (Eq. (13)).
where r = L/M is the reduction factor. After calculating the amount in all cells is the total amount of differences for the entire image (Eq. (14)).
The regression curve of log dependence log P N r ð Þon log (1/R) is constructed on the basis of the calculations. Fractal dimension D is defined as the tangent of the slope angle of the curve.
When using the triangulation method (TM), the image is divided into identical cells ε of size s Â s. Four heights equal to the intensities of pixels in the corners of the cells (a-d) are considered. At the intersection of the diagonals of the cell, the point (e) is set, the value of which is equal to the arithmetic average of four heights. If we represent a cell in the form of a triangular prism, as shown in Figure 9, then it is necessary to calculate the area of the projected upper surface, shown in Figure 8.
First of all, the values of the sides of the four triangles, obtained by connecting the diagonals of the cell, are calculated (Eqs. (15) and (16)).

Figure 7.
Three-dimensional representation of the image with its gray levels [15].
Then, using the Heron formula, the semi-perimeters and areas of all triangles are calculated (Eqs. (17) and (18)).
The total surface area is equal to the sum of the areas of individual triangles (Eq. (19)).
This procedure is repeated for all cell sizes. Then a regression line is constructed, which determines the dependence of the logarithm of the total area of all the triangles log (S) on the logarithm of the cell size log (ε) (Figure 10).
To calculate the fractal dimension, it is necessary to find the tangent of the angle of inclination of the constructed curve B. It can be calculated using Eq. (20).
ε, S are the average values of the corresponding parameters. The desired value of the fractal dimension D is calculated by Eq. (21).
In grayscale images, there is only one brightness level of each pixel of the image, while in a color image there are three color values (red, green, and blue) for each pixel of the image. As a result, to estimate the fractal dimension of color images, it is necessary to calculate the dimension for three different color levels. Using the estimation methods of calculating the fractal dimension for images in grayscale, one can calculate the dimension of a color image.
To calculate the dimension of a color image using the DBC method, the same method of calculating dimensions is used as in the grayscale images. In the color image, the dimension is calculated for the red R, green G, and blue B components. According to the DBC technique for each stage (red, green, and blue), you can apply the technique to images in shades of gray. After finding the results of each step, the results of different color levels are combined. As a result, you can get the dimension of the color image: R: n rr (i,j) = l-k + 1 for red values; G: n rg (i,j) = l-k + 1 for green values; B: n rb (i,j) = l-k + 1 for blue values. According to the above, you can find the fractal dimension of the color image N r{r,g,b} (Eq. (22)).
When calculating the dimension of color images by the triangulation method, first of all, the particular values of the fractal dimension for each color component are determined, and then their average value is calculated.

Testing methods for estimating fractal dimension
To test the methods for evaluating the fractal dimension, two methods triangulation and DBC were considered. Testing was carried out with the help of fractal objects for which the dimension is known. Table 2 presents the results of testing the above assessment methods using fractals with a known dimension value.
In Table 2, the following designations are made: Δ TM % ¼D TM ÀD D Á 100% is the absolute error in estimating the dimension between the measured and the true value of the fractal dimension by the triangulation method.
Δ DBC % ¼D DBC ÀD D Á 100% is the absolute error in estimating the dimension between the measured and the true value of the fractal dimension by the DBC method. The numerical data of the absolute errors of measurement of the dimension with the help of triangulation and DBC methods show that they give comparable results. The error of calculations for both methods does not exceed 5%. For practical use, it is advisable to use both methods, and the dimension values to find by averaging the results of both methods. In this case, the total error of calculations does not exceed 3%.

The measurement results of the fractal dimension of fractal keys
To illustrate the possibility of detecting an embedded watermark in images, we consider the experimental results of the evaluation of the fractal dimension after embedding the watermark in a fractal image based on Julia set. Table 3 shows the results of measuring the fractal dimension of color fractal images in the form of a Julia set when embedding watermark by various known steganographic methods.
The results show that the steganographic introduction of data does not actually affect the value of the fractal dimension, which makes it impossible to illegally extract the watermark.

Conclusions
The secrecy of steganographic systems is based on the assumption that the attacker is not aware of the fact of the information being introduced. In the event that this fact becomes publicly available, it will not be difficult for an unauthorized user to extract secret data or delete a given watermark. To solve this problem, it was proposed to use an additional container in the form of an algebraic fractal in the form of a Julia set.
Fractal generation is carried out using predefined secret parameters using the escape time algorithm (Escape time algorithm).
Embedding a digital watermark in a container was carried out in two stages. At the first stage, the watermark is added to the generated fractal. The resulting image is embedded in the original container in JPEG format. As a result, the original image has almost no visual distortion. The measurement of the values of the NMSE and PSNR metrics confirmed the high level of embedding quality and extraction of the watermark in the form of a QR code.
To confirm the high level of secrecy, an experiment was conducted, during which an attempt was made to replace the original secret key. The experiment Starting point c confirmed that it is impossible to extract the watermark without knowing the true parameters of the fractals.

Number of iterations
To assess the possibility of detecting the fact of embedding a watermark on the basis of fractals, the fractal dimension of intermediate containers was measured on the basis of the Julia set. Measurement of the dimension value was carried out before and after steganographic embedding. The results showed that the fractal dimension varies slightly, within the limits of the method error, and cannot be a sign that characterizes the presence of an integrated watermark.
The proposed technique allows for steganographic embedding with a high level of visual quality, as well as resistance to various steganographic attacks. As a result, it is possible to increase the level of secrecy of the watermark embedding algorithms and significantly reduce the likelihood of data theft.

Author details
Oleg Sheluhin and Dzhennet Magomedova* Information Security Department, Moscow Technical University of Communication and Informatics, Moscow, Russia *Address all correspondence to: jimagomedova@gmail.com © 2020 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/ by/3.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.