Next Article in Journal
Robust Photovoltaic Power Forecasting Model Under Complex Meteorological Conditions
Previous Article in Journal
Quantifying Truthfulness: A Probabilistic Framework for Atomic Claim-Based Misinformation Detection
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Square-Based Division Scheme for Image Encryption Using Generalized Fibonacci Matrices

by
Panagiotis Oikonomou
1,
George K. Kranas
2,
Maria Sapounaki
2,
Georgios Spathoulas
2,3,*,
Aikaterini Aretaki
2,4,
Athanasios Kakarountas
2 and
Maria Adam
2
1
Department of Computer Science & Telecommunications, University of Thessaly, 35100 Lamia, Greece
2
Department of Computer Science & Biomedical Informatics, University of Thessaly, 35131 Lamia, Greece
3
Department of Information Security and Communication Technology, Norwegian University of Science and Technology, NO-2815 Gjovik, Norway
4
NASK National Research Institute, 01-045 Warsaw, Poland
*
Author to whom correspondence should be addressed.
Mathematics 2025, 13(11), 1781; https://doi.org/10.3390/math13111781
Submission received: 24 March 2025 / Revised: 17 May 2025 / Accepted: 19 May 2025 / Published: 27 May 2025
(This article belongs to the Section E1: Mathematics and Computer Science)

Abstract

:
This paper proposes a novel image encryption and decryption scheme, called Square Block Division-Fibonacci (SBD-Fibonacci), which dynamically partitions any input image into optimally sized square blocks to enable efficient encryption without resizing or distortion. The proposed encryption scheme can dynamically adapt to the image dimensions and ensure compatibility with images of varying and high resolutions, while it serves as a yardstick for any symmetric-key image encryption algorithm. An optimization model, combined with the Lagrange Four-Square theorem, minimizes trivial block sizes, strengthening the encryption structure. Encryption keys are generated using the direct sum of generalized Fibonacci matrices, ensuring key matrix invertibility and strong diffusion properties and security levels. Experimental results on widely-used benchmark images and a comparative analysis against State-of-the-Art encryption algorithms demonstrate that SBD-Fibonacci achieves high entropy, strong resistance to differential and statistical attacks, and efficient runtime performance—even for large images.

1. Introduction

Cryptography is of significant importance in many aspects of our society. It serves as a fundamental pillar in the security of mobile phone communications, e-commerce platforms, email exchanges, financial transmissions, ATM card protection, and computer passwords. Cryptography, rooted in mathematics, has expanded its scope to tackle the ever-increasing demands of our digital world, particularly in the realm of image and video transmission [1,2]. Therefore, the integration of cryptography with modern computer science has become a necessity [3]. Images are vulnerable to unauthorized access and manipulation and may pose significant risks to individuals and organizations. Consequently, image encryption ensures the integrity and trustworthiness of digital visual data. Although image encryption is not a new concept, recent years have witnessed a growing interest in the development of efficient and secure image encryption algorithms [4,5] capable of real-time encryption and decryption. This is particularly vital in environments such as cloud or fog and edge computing, where the need for fast and reliable encryption mechanisms is paramount [6,7,8].
A common approach for image encryption is to apply a symmetric-key encryption algorithm, i.e., a cryptographic technique that uses a single key for both the encryption and decryption processes. The key is presented in the form of a matrix and is used by both the sender and the receiver to secure the images’ pixels. Algorithms in this category are widely used for image encryption due to their simplicity and low processing power requirements, which makes them preferred for encrypting big data. They apply simple mathematical operations, such as permutation and transformation, to image pixels or blocks of pixels. However, the key must be an invertible matrix for reversible encryption and decryption processes. The application of symmetric key encryption for images poses several challenges related to key size, key management, and image handling, especially in cases of non-square images. Therefore, an approach that will facilitate key management by reducing the volume of data needed for key extraction is necessary. In addition, a way of applying the primitive cryptographic operation is required for images that are oddly sized or too large. Given the current requirements concerning the volume of data exchanged and the accepted communication speeds, any proposed approach should be fast enough and not induce any significant overhead.
Most of the prior research has concentrated on encryption algorithms for square images, with little attention paid to non-square ones. In [9], the authors develop an encryption–decryption approach studying m × n images for special values of m, n and using two different types of key matrices, the generalized Fibonacci matrix and the Pascal matrix. They use the Lagrange Four-Square theorem for the encryption process along with two different types of key matrices, the generalized Fibonacci matrix and the Pascal matrix. However, their approach is time-consuming and has significant computational costs, especially in high-quality images. In this study, a fast and novel encryption approach is presented, tailored to non-square images by introducing a square block division scheme.
The proposed scheme uses an optimization process to divide the entire non-square image into square blocks of different sizes; thus ensuring that the algorithm can be applied to diverse image dimensions while enhancing the encryption strength and dispersing the effects of encryption throughout the entire image. Each image block is encrypted by a different key matrix resulting from the direct sum of powers of generalized Fibonacci matrices, whose rightmost element of the first row is one. The encryption scheme, called Square Block Division-Fibonacci (SBD-Fibonacci), tackles the invertibility constraint imposed by the cipher algorithm since the determinant of the key matrix always equals +1 or −1. This design allows the cipher algorithm to be applied efficiently and robustly to any type of image. The following list summarizes our contributions:
  • A novel and efficient square block division scheme based on an optimization model is proposed for fast processing of non-square images.
  • A key generation approach based on generalized Fibonacci matrices ensures invertibility and simplifies key management (SBD-Fibonacci algorithm).
  • The Lagrange Four-Square theorem is used to minimize the percentage of small encryption blocks and to increase encryption security images of any size/dimension.
  • A statistical analysis of our approach is conducted, using various widely used benchmark images, to confirm that it performs well and is effective.
The remainder of the paper is organized as follows. Section 2 refers to some recent progress in the field of image encryption and Section 3 provides a concise overview of the fundamental matrix theory utilized in the encryption and decryption processes. Section 4 is devoted to a detailed description of the proposed image encryption and decryption algorithms based on a novel square block division technique. Section 5 illustrates the optimization process used to minimize the number of multiple single pixels generated within the preceding scheme. An extended experimental evaluation using various widely used benchmark images that showcases the performance of the proposed regime in resisting various statistical attacks is provided in Section 6, followed by a comprehensive discussion, in Section 7 where we compare our findings with the existing literature. Finally, Section 8 concludes the paper.

2. Related Work

During the past decade, numerous researchers have explored encryption methods that leverage chaos theory with several cryptographic techniques, see [10,11,12,13,14,15,16,17] and the references therein. In [18], the authors proposed a technique based on improved chaotic maps and a secure variant of Hill Cipher. Their method provided pixel-by-pixel encryption, unlike the conventional Hill Cipher, encrypting pairs of adjacent pixels two by two. The authors in [19] introduced a hyperchaotic map and a pixel fusion strategy to encrypt images more effectively and speed up calculations. They performed encryption by grouping multiple pixels into one, thus reducing computational cost, and produced a common keystream, simplifying key management. True random number generators can contribute to the development of high-security cryptographic schemes [20,21,22]. In [23], the researchers proposed a random number generator combining a deep learning model with chaotic systems for the image encryption key to exhibit strong randomness and preserve the statistical properties of the original data without revealing sensitive information. A scheme of color image encryption based on an improvement of the Hill Cipher algorithm was proposed in [24,25]. The algorithm was based on an affine transformation provided by a three-order invertible matrix and a chaotic translation vector.
Generalized Fibonacci matrices, which have an important place in the field of mathematics, have been utilized in several encryption and decryption techniques because of their connection to the interesting behavior of the Fibonacci sequence [26,27]. The algorithms designed in [28] were based on Fibonacci polynomials and combinations of Hill Cipher encryption alongside the sigmoid logistic map and Kronecker product matrix techniques. The encryption schemes in [29,30,31] benefited from the mathematical robustness of the generalized Fibonacci matrices in modifying the pixel values to enhance the diffusion effect on neighboring pixels and make it harder for attackers to decipher the image. The presented image encryption technique in [32] utilized a Fibonacci matrix for image scrambling and a Fibonacci matrix for the diffusion phase. Chaotic maps were also employed to generate key sequences and introduce further confusion in the image pixels.
As encryption scheme continues to evolve, researchers have begun exploring the integration of optical technologies, biological-inspired coding methods or a combination of two or more techniques. To this effect, image encryption strategies now dictate more robust and computationally efficient approaches. Recent advances have leveraged the combination of optical imaging, chaos encryption and DNA coding. For instance, a dual-channel image encryption and authentication technique has been proposed in [33]. In this scheme, a 4D chaotic system and DNA operations have been employed for image encryption in the digital channel, while Computational Ghost Imaging and the Logistic map have been used for the authentication in the optical channel. The utilization of optical technologies in image encryption offers high parallelism and complexity to the encryption process [34].
Chaos-based methods and DNA manipulation maintain a high level of security for image encryption while ensuring the minimum hardware resources [35,36,37,38]. Nevertheless, certain security flaws can be detected upon being subjected to cryptanalysis, a pivotal process in ensuring the rationality, practicality, and security of image encryption algorithms or schemes. Based on the cryptanalysis of the Quantum Chaotic Map and DNA Coding scheme in [39], security weaknesses were revealed due to the existence of an equivalent key and the absence of both confusion and diffusion in the DNA domain encryption. In addition to integrating modalities such as optics, hybrid approaches combining encryption with watermarking have emerged to tackle persistent security challenges. The authors in [40] developed a new model for the embedding of digital watermarks using a frequency domain transformation and a channel attention mechanism. Their model improved the adaptability and robustness of the watermark across different types of content.

3. Materials and Methods

Generalized Fibonacci Matrix: For a positive integer k 2 and nonnegative real numbers c 1 , c 2 , , c k , the n-th term of the k-generalized Fibonacci number is defined recursively as
f n = c 1 f n 1 + c 2 f n 2 + + c k f n k , n k + 1 ,
with initial values f 1 = = f k = 1 . Let Q ( c 1 , , c k ) be the k × k generalized Fibonacci matrix associated with the sequence ( f n ) n k + 1 , namely
Q ( c 1 , , c k ) = q c k I k 1 0 ,
where q = c 1 c k 1 is an 1 × ( k 1 ) matrix, I k 1 is the ( k 1 ) × ( k 1 ) identity matrix and 0 is the ( k 1 ) × 1 zero matrix. Then, the linear recurrence relation (1) can be represented in the matrix form
f n f n 1 f n k + 1 = Q ( c 1 , , c k ) f n 1 f n 2 f n k
for every n k + 1 . Note that Q n ( 1 , 1 ) derives the Fibonacci sequence while Q n ( 1 , 1 , 1 ) produces the Tribonacci sequence. The powers of Q ( c 1 , , c k ) play a crucial role in the design of image encryption schemes as they provide closed forms for higher-order terms in generalized Fibonacci sequences [26]. This property is employed in efficient confusion and diffusion processes of image pixel values and leads to faster implementations, reducing the time as well as the space complexity of the security process. Furthermore, the determinants of these powers extend known identities such as Cassini’s and Sharpe’s identities, and their spectral analysis leads to sharp spectral radius bounds [26,41]. A simple calculation gives that d e t ( Q ( c 1 , , c k ) ) = ( 1 ) k + 1 c k .
For the implementation of our proposed algorithm, we consider the entries c 1 , , c k 1 in Equation (2) to be randomly generated nonnegative integers, c k = 1 , and take the generalized Fibonacci matrix
Q ( c 1 , , c k 1 , 1 ) = c 1 c 2 c k 1 1 1 0 0 0 0 1 0 0 0 0 1 0 : = Q ,
with determinant
d e t ( Q ) = ( 1 ) k + 1 = ± 1 0 .
The latter equality guarantees that the matrix Q is invertible within modular arithmetic, that is, g c d ( d e t ( Q ) , ν ) = 1 for any ν N with ν 2 , allowing reversible image data transformations. The randomly selected parameters c 1 , , c k 1 lead to complex diffusion patterns across the image that can form a large and sensitive key space, thus enhancing the security level of our scheme against unauthorized decryption attempts.
Direct sum of matrices: Let A 1 , , A p be n × n matrices whose entries are nonnegative integers; their direct sum, which is denoted by “⊕”, is defined by the n p × n p matrix
A 1 A 2 A p = d i a g ( A 1 , A 2 , , A p ) = A 1 O O O A 2 O O O A p ,
where O denotes the n × n zero matrix. Recall that d e t ( A 1 A 2 A p ) = d e t ( A 1 ) × d e t ( A 2 ) × × d e t ( A p ) .
Encryption and Decryption: Let P be an m × n matrix and K be an m × m matrix with nonnegative integers as entries. The encryption process is performed by
E = ( K P ) mod ω ,
where ω N is the cardinality of the set of numbers in P and K is called key matrix. An essential feature of the key matrix K in Equation (6) is that it must be invertible, which means d e t ( K ) 0 . Then, the decryption process is defined by the reverse operation of the encryption algorithm and it is formulated by
P = ( K 1 E ) mod ω ,
where K 1 denotes the inverse matrix of K. The modulo operation applied on each element of the resulting matrices K P and K 1 E in Equations (6) and (7), respectively, ensures that the values lie within the required range [ 0 , ω 1 ] .
Additionally, notice that the determinant of the key matrix and the modular base ω used in the encryption must be coprime, that is g c d ( d e t ( K ) , ω ) = 1 . It is worthwhile to note that for K = ( Q 1 Q p ) r , where Q i , i = 1 , , p are k × k generalized Fibonacci matrices as in Equation (3) and r N , we obtain
d e t ( K ) = ( d e t ( Q 1 ) ) r × × ( d e t ( Q p ) ) r = ( 1 ) ( k + 1 ) p r = ± 1 ,
due to Equation (4). Hence, the key matrix K constructed in this way is always an invertible matrix and also
g c d ( d e t ( K ) , ω ) = 1 .
For the encryption and decryption of images, an identical mechanism may be employed, which initially involves converting the image into a matrix whose entries correspond to its pixel values. According to the aforementioned setting, P, E and K represent the original image, the encrypted image and the encryption key, respectively. We note that in a grayscale image ω = 256 , because each pixel element has an assigned intensity in the range [0, 255]. Table 1 summarizes the notation adopted in this paper.

4. SBD-Fibonacci Algorithm

The basic steps of the proposed SBD-Fibonacci algorithm for image encryption are the following: (1) Square Block Division (SBD). The input image is divided into non-overlapping square blocks of varying sizes (Section 4.1). (2) Optimization using Lagrange Four-Square Theorem. To minimize the number of vulnerable small blocks ( 1 × 1 or 2 × 2 ), the Lagrange Four-Square theorem is applied. This technique merges multiple small blocks into larger, more secure blocks (Section 4.2). (3) Master Key Generation: A master key consisting of a list of randomly generated integer values is created providing the basis for the construction of encryption keys for all individual blocks (Section 4.3). (4) Encryption Key Construction. This step is applied to each square block. Specifically, if the block size is greater than 2 × 2, a generalized Fibonacci matrix is generated and modified using the master key. Otherwise, a simple multiplication with a master key element is applied (Section 4.3). (5) Block-wise Encryption. Each block is encrypted individually using its corresponding key matrix (Section 4.3). (6) Cipher Image Assembly. The encrypted blocks are recombined to form the final encrypted image (Section 4.3).
The execution flow of the SBD-Fibonacci algorithm is presented in Figure 1. Based on that, initially, the image will be segmented into a collection of blocks via our SBD scheme. After that, using a generalized Fibonacci matrix as our key basis, an encryption key will be generated and finally, each block will be encrypted using the basic steps of the cipher algorithm described in the previous section.

4.1. Square Block Division (SBD)

In this subsection, we present a novel division scheme that divides the entire image into square blocks of different sizes, which will also be called samples. To the best of our knowledge, this is the first time such an approach has been presented and also applied in image cryptography. Algorithm 1 demonstrates the division process of the SBD-Fibonacci algorithm in a top-down approach.
Algorithm 1 Square Block Division Algorithm
Input:  m , n , b , p
Output: list of square blocks, S B
1:
R m a x 0 , C m a x 0
2:
S B
3:
for  z p to 1 do
4:
     R m a x R m a x , C m a x C m a x
5:
     x b z
6:
    for  i R m a x to m step x do
7:
        for  j C m a x to n step x do
8:
            createBlock(i,j,x)
9:
        end for
10:
  end for
11:
  if  z p  then
12:
      for  i 0 to R m a x step x do
13:
          for  j C m a x to n step x do
14:
              createBlock(i,j,x)
15:
          end for
16:
      end for
17:
      for  i R m a x to m step x do
18:
         for  j 0 to C m a x step x do
19:
              createBlock(i,j,x)
20:
          end for
21:
      end for
22:
   end if
23:
end for
24:
return  S B
The algorithm requires four inputs. The variables m and n represent the total number of rows and columns of the image, respectively. The division is performed iteratively (lines 3–23), starting with large sample sizes and gradually reducing the sample sizes based on the next two input parameters: the base size b and the number of divisions p. At each iteration, the algorithm attempts to fit as many square blocks of size b p , b p 1 , , b 0 as possible within the remaining undivided areas. This ensures the efficient handling of large images with varying dimensions. To select the optimal values of b and p for a given image, an optimization process is employed and presented in Section 5. The goal is to minimize the number of single-pixel or very small blocks, as they may pose vulnerabilities in the encryption strength. The optimization is based on a heuristic that analyzes how different choices of b and p impact the fragmentation of the image, seeking combinations that reduce the number of isolated pixels. The outer for loop (line 3) is executed p times and in each iteration, one or more square blocks of size b z × b z are generated with z N , z [ 0 , p ] , starting with b p × b p blocks and gradually reducing to b 0 × b 0 . After the division process, the maximum size of the blocks will be b p × b p , while the minimum size will be 1 × 1 (if any). Note that not all iterations will result in square blocks, as the current block size, b z , may exceed the remaining dimensions of the undivided image.
In Figure 2, we use a 67 × 71 sample image to illustrate different scenarios of square block division when varying b and p values. Table 2 displays the total number and size of the square blocks generated for each combination. Note that these small image dimensions of prime numbers are employed solely for demonstration purposes. In more practical scenarios, image dimensions are larger and more efficient, and b and p values need to be selected in a way that prevents the formulation of numerous instances of 1 × 1 blocks. Therefore, the optimization process described in Section 5 is initially performed to determine the best combination of b and p. These optimized values are then used as inputs in SBD.
Variables R m a x and C m a x represent the maximum row and column value encountered during each division step, respectively. They are updated within the algorithm when a new division iteration is initiated (line 4). These variables play an important role in the proposed algorithm as they are used to keep track of the current maximum row and column offsets from the previous square block division. As a result, the subsequent iterations of the algorithm will only focus on the remaining undivided parts of the image, eliminating redundant checks on the previously divided sections. This optimization leads to significant gains in the overall execution runtime of the algorithm.
The purpose of the inner loops is to perform the necessary divisions in the image (lines 6–10, 12–16, and 17–21). Their operation is similar, however by varying their ranges and step sizes, different parts of the same image are considered for division. In the first iteration of the outer loop both R m a x and C m a x are set to zero and the inner nested loop (lines 6–10) iterates over the entire image with a step size of x. In this way, the image is divided into b p × b p blocks, with b p being the maximum accepted size. In the subsequent iterations, when the if condition of line 11 is true, all three nested for loops are executed and examine different undivided portions of the image. The third inner loop (lines 17, 18) iterates over the bottom-left part of the image, the second inner loop (line 12, 13) iterates over the top-right part, while the first inner loop (line 6, 7) iterates over the remaining image.
Algorithm 2 Function createBlock
Input:  r , c ,
1:
if  r + 1 < m && c + 1 < n  then
2:
     s = r , c , , s P
3:
    push s into S B
4:
    if  r + > R m a x  then
5:
         R m a x r +
6:
    end if
7:
    if  c + > C m a x  then
8:
         C m a x c +
9:
    end if
10:
end if
11:
Update  S B , R m a x , C m a x
The createBlock function is an essential component of the SBD algorithm, being called within a nested loop structure to execute specific tasks during each iteration of the division process. This function serves three main purposes: block creation, list appending and updating maximum cut dimensions. We consider each square block as a tuple of four elements: s = r , c , , s P , where r and c represent the row and column position (index) of the block within the image, describes the length of the block and s P is an × sub-image of P that contains a sample from the plaintext from r : r + row and c : c + column. The algorithm starts with an empty list S B (Algorithm 1, line 2) and progressively appends square blocks (Algorithm 2, line 3) into S B . Line 1 in Algorithm 2 guarantees that block dimensions do not exceed image boundaries. Through lines 4–9 in Algorithm 2, variables R m a x and C m a x keep track of the maximum row and column value encountered during the creation of a new square block.

4.2. Lagrange Four-Square

The SBD algorithm can generate multiple 2 × 2 and 1 × 1 square blocks depending on the size of the image. This could be considered a weak point in our encryption approach, making the block structure uniform and easy to predict. To address this issue and introduce more variability in the division scheme, we apply the Lagrange Four-Square theorem, which asserts that a positive integer can be expressed as the sum of at most four squares of positive integers. In this context, all pixel values of the above blocks are concatenated into a single vector of size v l and then the theorem is applied to v l , i.e., v l = i 2 + j 2 + k 2 + l 2 , where i , j , k , l N { 0 } . To find the list f s d : = [ i , j , k , l ] , we use brute-force search in Algorithm 3 by testing all possible combinations of i j k v l and we calculate l by the formula l = v l i 2 j 2 k 2 (lines 2–5). If the resulting l is an integer, the required 4-tuple of integers is returned (lines 6–13). The if statement in line 10 ensures that the output list will contain the fewest possible zeros and ones. Afterwards, the vector containing the pixel values is reshaped in SBD-Fibonacci algorithm (lines 11–12) to form new square blocks with dimensions determined by the positive integers from the output list. This technique limits the maximum number of vulnerable 2 × 2 and 1 × 1 square blocks to four, thus reinforcing our encryption scheme and enhancing its security.
Algorithm 3 Lagrange Four-Square
Input: Vector Length, v l
Output: Four-Square Dimensions, f s d
1:
initialize empty list s q u a r e s
2:
for i [ 0 , v l ]  do
3:
    for j [ i , v l ]  do
4:
        for k [ j , v l ]  do
5:
            l v l i 2 j 2 k 2
6:
            if l R l = l  then
7:
                 t m p _ s q u a r e s [ i , j , k , l ]
8:
                 n u m _ o n e s s u m ( t e m p _ s q u a r e s = 1 )
9:
                 n u m _ z e r o s s u m ( t e m p _ s q u a r e s = 0 )
10:
              if  i s e m p t y ( s q u a r e s ) ( n u m _ o n e s + n u m _ z e r o s ) < ( s u m ( s q u a r e s = 1 ) + s u m ( s q u a r e s = 0 ) )  then
11:
                   s q u a r e s t m p _ s q u a r e s
12:
                end if
13:
            end if
14:
        end for
15:
     end for
16:
end for
17:
return  s q u a r e s as f s d

4.3. Key Generation and Encryption

The proposed SBD-Fibonacci algorithm illustrates the encryption process and generates the required key matrix. Its input is the list S B , which consists of the square blocks, s, produced by SBD and represents the plaintext P.
Algorithm 4 Key_Generation function
Input: k q , k d , d , i n d e x , L
Output: Encryption key, K
1:
for  i 0 to k d step d do
2:
    for  j i to i + d 1  do
3:
         k q i , j L i n d e x
4:
         i n d e x i n d e x + d 1
5:
    end for
6:
end for
7:
return  k q as K
In order to encrypt and decrypt the divided image, a simple solution could be to create and store a different key, K, for each block s. However, this would require an undefined number of unique keys and would create significant implications for key management. Instead, to avoid that, the algorithm starts by generating a master key L, which is a list of randomly selected integers within the range [ 0 , 255 ] with length s L = 256 . Algorithm 4 is implemented to incorporate L into each K corresponding to a block s with s . > = 2 .
Algorithm 5 SBD-Fibonacci Algorithm
Input: S B
Output: Encrypted image, E
1:
l s , l s
2:
generate list L
3:
i n d e x 0
4:
for each s S B  do
5:
if  s . 2  then
6:
      l s . a p p e n d ( s )
7:
      S B . r e m o v e ( s )
8:
end if
9:
end for
10:
Convert square blocks of l s into a vector, l s
11:
s d L F S ( l e n ( l s ) )
12:
Generate Square Blocks from s d
13:
Append new Square Blocks into S B
14:
for each  s S B  do
15:
    if  i n d e x = 256  then
16:
          i n d e x 0 Reuse elements if s L is exceeded
17:
    end if
18:
    if  s . = 1  then
19:
          K L i n d e x
20:
          i n d e x i n d e x + 1
21:
          e ( K × s . s P ) mod 256
22:
    else
23:
         if  s . 2  then  d SD( s . ) s.t d 3  else  d = 2
24:
          k d s . / d
25:
          k q Q Q k d times
26:
          K K e y _ G e n e r a t i o n ( k q , i n d e x )
27:
          K K d
28:
          e ( K × s . s P ) mod 256
29:
    end if
30:
    place e into E
31:
each for
32:
return  E
The master key L serves as the foundation for constructing the encryption keys for each block. For blocks with s . 2 , the key generation process involves several steps to ensure the security and uniqueness of each block’s key matrix. Initially, a generalized Fibonacci matrix Q is generated based on randomly selected parameters. This matrix is then expanded using the direct sum operation to match the size of the block. Specifically, the direct sum k q = Q Q Q is created, where k d is the ratio of the block size to the smallest divisor d of the block size. The elements in the first row of each Q in the direct sum are replaced with the values from the master key L, except for the rightmost element, which remains fixed at one. This ensures that the resulting key matrix K is always invertible. The key matrix K is then raised to the power of d to construct the final encryption key for the block.
A detailed description of the key generation process and encryption scheme is provided in the following paragraphs.
Algorithm 5 examines each block s contained in S B in an iterative fashion. As previously mentioned, the SBD process generates square blocks of various sizes s . × s . , with a minimum of s . = 1 pixel. However, multiple blocks with s . 2 can lead to security breaches and put the encryption process at risk. To address this issue and strengthen the encryption, we employ the Lagrange Four-Square theorem, as explained in the relevant subsection. Hence, the 2 × 2 and single-pixel blocks are excluded from the main list S B and stored separately in a vector, called l s (lines 4–9). Then, Algorithm 3 is applied to the length of the vector l s to return a list, s d , of four nonnegative integers (line 11). The positive integers in s d will determine the size of at most four new square image blocks that will be added to S B (lines 12–13). Note that this process can still create 2 × 2 and 1 × 1 blocks, but now their number is reduced to a maximum of four, thus making the encryption process more robust.
The key generation and encryption processes are carried out between lines 14 and 31. Lines 18–21 involve multiplying a single pixel s with an element from the master key L, which represents the encryption key K. Once the multiplication is completed, the encrypted block, e, is created using the modulo-256 operation ensuring its value remains within the permissible pixel range. Alternatively, when the block s has s . 2 we proceed as outlined in lines 23–28. The following steps are conducted for key generation. Initially, we calculate the smallest divisor d = SD ( s . ) of s . that is greater than or equal to 3, otherwise, we set d = 2 (line 23). Then, a random d × d generalized Fibonacci matrix Q is considered as defined in Equation (3). This matrix is later enlarged to define the direct sum k q = Q Q Q as in Equation (5) of k d generalized Fibonacci matrices, where k d is the ratio of s . to d (lines 24–25). This operation ensures that the size of the key matrix will be compatible with the dimensions of the sample to be encrypted. Afterwards, Algorithm 4 is executed to replace the d 1 elements in the first row of every matrix Q in k q with entries from the list L and return the direct sum Q 1 Q k d (line 26). The resulting direct sum consisting now of k d different Fibonacci matrices is raised to the power of d to construct the encryption key K = ( Q 1 Q k d ) d (line 27). Throughout the procedure, it should be noted that all elements within the first row of Q j , j = 1 , , k d , have changed, except for the rightmost element, which is fixed at a value of one. This fact, combined with the discussion presented in Section 3 and Equation (8), guarantees that the matrix K is always invertible and satisfies Equation (9). Then, the key matrix K is multiplied by the sample and the modulo 256 operation is performed (line 28).
It is important to note that if the number of elements of L, which are used in the key generating process, exceeds 256, then those elements are reused according to lines 15–17 of Algorithm 5. The algorithm then combines all the encrypted blocks into an image that has the same dimensions as the original image P. This process leads to the encrypted image E and occurs between lines 30 and 32.

4.4. Decryption

The decryption scheme follows the process described in Section 3 to decrypt each block e of the encrypted image E and return the decrypted version D. Note that, when decrypting single pixels, the randomly generated integer key of the list L divides the encrypted sample and modulo 256 is applied to retrieve the original sample values. For square blocks of larger size, decryption is performed by applying Equation (7) to each square block e. Then, the intermediate results are combined and the plaintext is reconstructed. It should be noted that, as a means to decrypt an image, the receiver must be aware of the optimized values b and p to generate the image’s blocks, as well as the list L to be able to generate the keys for each block and finally decrypt.

5. Optimizing SBD-Fibonacci

The SBD-Fibonacci algorithm partitions the plaintext into multiple square blocks of sizes ranging from b p × b p down to b 0 × b 0 . Depending on the chosen values of variables b and p, various solutions can be generated. However, it is uncertain whether each of these solutions is suitable for image cryptography, as it is possible to generate multiple instances of single pixels. Encrypting numerous single blocks with the same key could potentially reveal meaningful information to an adversary. For example, as illustrated in Table 2, if we apply the division procedure, when b = 2 and p = 3 , 137 single pixels will be generated. Similarly, setting b = 4 and p = 2 generates 405 single pixels. Motivated by all the above, in this section, we present:
(a)
the mathematical equations determining the total number of single pixels generated for any given values of b and p,
(b)
an optimization model that minimizes the total number of single pixels, and a straightforward and efficient heuristic method for calculating the optimal b and p values.
The total number of single pixels is determined by applying two recursive formulas. To calculate the number of rows that are located at the bottom part of the image and contain entirely single pixels, we set x k + 1 = x k mod b p k and x 1 = m mod b p . In the same fashion, setting y k + 1 = y k mod b p k and y 1 = n mod b p will result in the number of total columns that contain entirely single pixels (right part of the image). The total number of rows and columns with single pixels are saved to the variables x p and y p , respectively. The overall number of single pixels after the block division procedure is formulated by
Z ( b , p ) = n · x p + m · y p x p · y p .
Notice that in Equation (10) the term x p · y p is subtracted to avoid the duplication of single pixels in the count.
As a demonstration example, we consider Figure 2f, where we set b = 6 and p = 2 and obtain 401 single pixels, as seen in Table 2. Using the following recursive calls: x 1 = 67 mod 6 2 = 31 , x 2 = 31 mod 6 1 = 1 ; therefore x p = x 2 = 1 . Similarly, y 1 = 71 mod 6 2 , y 2 = 35 mod 6 1 = 5 ; therefore y p = y 2 = 5 . Substituting into Equation (10) the above quantities, we take Z ( 6 , 2 ) = 71 · 1 + 67 · 5 1 · 5 = 401 verifying the total number of single pixels.
The objective of SBD-Fibonacci can be formally stated as follows: given an image of size m × n , find b and p values that minimize Equation (10) under the constrained minimization problem expressed by Equations (11) and (12) as follows:
min b , p Z ( b , p )
subject   to : x k + 1 = x k mod b p k , y k + 1 = y k mod b p k x 1 = m mod b p , y 1 = n mod b p b , p > 1 b p > 2 b , p N .
Block size affects both security and performance. Larger blocks enhance diffusion and security but increase computation and memory needs, while smaller blocks speed up processing but may degrade the resistance to common attacks. Therefore, the block size must be carefully balanced to optimize both security and performance. In particular, minimizing the number of 1 × 1 blocks is crucial and this balance is the primary motivation behind the proposed optimization strategy.
To solve the above optimization problem, we propose a fast heuristic algorithm presented in Algorithm 6. Overall, the heuristic aims to provide a combination of b and p, used in SBD, that minimizes the instances of singular pixels forming as blocks. This value is represented in variable z b e s t , which is initiated as + , (line 1). The combination of b and p should also generate a b p × b p block with b p min { m , n } . In lines 3–14, we examine different b values starting from a predefined threshold b m a x up to 2, b m a x can be set from [10, 20] according to image dimensions. The iteration is performed in descending order as the powers b p will always produce the same modulo value when divided by x, where x : = min { m , n } . Also, since the powers b p provide the same modulo, we do not need to iterate through all permutations of b , p ; thus, we calculate its logarithm (line 4). In lines 4–7, we exclude the possibility of p = 1 whilst being a feasible solution as it would force SBD to create b × b blocks. In line 8, we calculate the number of singular pixels using Equation (10) and keep the best b , p combination in variables b b e s t , p b e s t . The overall time complexity of this algorithm is O ( b m a x ) .
Algorithm 6 SBD-Fibonacci optimizer
Input: m , n
Output: b b e s t , p b e s t values
1:
z b e s t +
2:
x m i n ( m , n )
3:
for  b b m a x to 2 step 1  do
4:
     p l o g b x
5:
    if  p 1  then
6:
        continue
7:
    end if
8:
     z Z ( b , p )
9:
    if  z < z b e s t ( b p m b p n )  then
10:
       z b e s t z
11:
       b b e s t b
12:
       p b e s t p
13:
  end if
14:
end for
14:
return  b b e s t , p b e s t

6. Experimental Evaluation

Image datasets: We report on the experimental evaluation of the SBD-Fibonacci algorithm relying on six images from [42,43] as depicted in Table 3, where b m a x is equal to 20.
The adopted images are extensively used in the relevant literature (e.g., Lena and Barbara) and also cover a wide range of different image properties e.g., resolution, dimensions, and low-high luminance. Each color image is transformed to grayscale by decomposing the color channels (R, G, and B) into a single channel representing the grayscale intensity. The transformation is performed using the average method ( G r a y = ( R + G + B ) / 3 ). We should note that the SBD-Fibonacci algorithm can be applied in both grayscale and color images. When dealing with color images, the encryption process involves a two-step approach. First, the color image is decomposed into its respective (R, G, B) components. Each component is then encrypted separately using SBD-Fibonacci. Finally, the encrypted components are concatenated together to obtain the encrypted color image.
Figure 3 describes the process based on which the SBD algorithm produces the blocks illustrated by the red grids.
Performance evaluation: In the following sections, we present simulation results and performance analysis of the SBD-Fibonacci algorithm. Since a robust cryptosystem should demonstrate resistance against various known attacks, our evaluation of the SBD-Fibonacci includes key space analysis, statistical analysis and differential analysis. To ensure statistical reliability, the algorithm has been executed 50 times under identical conditions, i.e., the image dimensions and parameters b and p remain invariant per each experiment. This method of averaging over multiple runs has been employed to compensate for the impact of random variability leading to a more stable and reliable assessment of the algorithm’s capabilities. The results obtained from these 50 runs have been averaged and then discussed in Section 6.1, Section 6.2, Section 6.3, Section 6.4, Section 6.5 and Section 7.

6.1. Histogram Analysis

Histogram analysis provides information on the frequency distribution of gray levels within an image. To ensure the security of an encryption algorithm, it is essential that the histogram of the cipher image exhibits an evenly distributed pattern and is significantly different from the plaintext. From the histograms presented in Figure 4, Figure 5 and Figure 6 it is obvious that the encrypted images are random images and their histograms are distributed uniformly. This shows that there is no connection between the information in the encrypted image and the information in the plaintext one, so a potential attacker does not gain insight into the actual information by checking the encrypted image.

6.2. Key Space Analysis

A secure encryption scheme necessitates a key space that is sufficiently large so as to resist brute-force attacks [12,19]. The proposed encryption algorithm is a symmetric encryption algorithm with a master key L. This is a list of 256 integer values in the range of [ 0 , 255 ] . The elements of the list are used to populate the matrices that will be used to encrypt partial blocks of the image. The actual order according to which the elements of L will be used and the minimum number of elements required are defined by the dimensions of the matrix to be encrypted and the choice of parameters b and p. In order for encryption or decryption operations to proceed, both the master key L and the b , p parameters must be known. The key space comprises all possible combinations of master keys with parameters b , p . The length of the master key list is s L = 256 ; thus, the number of possible keys is calculated as 256 s L = ( 2 8 ) s L = 2 8 s L = 2 2024 .
Therefore, the key space provides a level of security of 2048 bits. Taking into account that different combinations of parameters b , p trigger different combinations of master key (L) elements, the actual level of security is even higher than 2048 bits. The selected value for s L , in addition to providing the required level of security, provides the required number of values to minimize reuse of identical K matrices as partial keys. Even for large images (e.g., 8 K image with high resolution 7680 · 4320 ), the reuse of elements is bearable. The described findings prove that the proposed algorithm is robust against key brute force attacks because of the key space and against key reuse attacks because the probability of having the same key multiple times is negligible.

6.3. Key Sensitivity Analysis

Key sensitivity analysis assesses the level of security provided by an encryption algorithm. It measures how small changes in the encryption key impact the confidentiality of the encrypted image, helping to identify vulnerabilities and enhance the algorithm’s robustness against attacks. Higher values of key sensitivity indicate the robustness of the encryption algorithm [12,19].
Toward the evaluation of the key sensitivity of the proposed algorithm, each image has been encrypted twice using two keys that slightly vary. Once the image is encrypted with the first encryption key generated by Algorithm 4, the second key is created similarly by slightly altering the elements of L, increasing them by 1. Following the generation of the second key, the encryption process is applied to the same image employing the modified key. Finally, the two encrypted images are compared to assess the key sensitivity of the SBD-Fibonacci algorithm.
The key sensitivity value for each image is Lena: 99.549; Barbara: 99.560; Street: 99.551; House: 99.514; Staircase: 99.527; Josue: 99.498. We observe that every image has a key sensitivity value of at least 99%. This verifies that SBD-Fibonacci is key-sensitive; thus, minor changes in the encryption key lead to significant differences in the corresponding encrypted images. The fact that the proposed algorithm is key sensitive makes it robust against any attacks trying to manipulate its operation and retrieve part of or the full encryption key by an iterative similarity-based search in the key space.

6.4. Correlation Analysis

Correlation analysis is a crucial assessment of the quality of the encryption provided by an algorithm, as well as its resistance against attacks and the level of probable information leakage, by evaluating the correlation patterns between the elements of an image, in its original and encrypted form. The similarity or dissimilarity between the corresponding image elements will provide a clear depiction of the algorithm’s security. An image contains adjacent pixels with high correlation (high similarity). When encrypted by a good encryption algorithm, these pixels should not correlate in any way (high dissimilarity). To evaluate our algorithm, we calculate the correlation coefficients in a horizontal, vertical, and diagonal direction, which is given by
C C = i = 1 n ( x i 1 n j = 1 n x j ) ( y i 1 n j = 1 n y j ) i = 1 n ( x i 1 n j = 1 n x j ) 2 i = 1 n ( y i 1 n j = 1 n y j ) 2
In Equation (13), x i and y i consist of a pair of adjacent pixels in any of the aforementioned directions, while n is the total number of pairs of adjacent pixels.
The correlation analysis is presented in Table 4, Figure 7 and Figure A1, Figure A2, Figure A3, Figure A4 and Figure A5 of the Appendix A, where CC(P), CC(E) denote the correlation coefficient of the plaintext and encrypted image, respectively, and the terms H, V, and D denote the horizontal, vertical, and diagonal directions, respectively. From the results, it can be seen that the correlation for the plaintext image is close to 1, while the encrypted image’s results are close to 0. The above further verifies that the encrypted images by SBD-Fibonacci have an extremely low correlation. This proves that there are no artifacts in the encrypted images that can be attributed to elements of the plaintext images. The encryption process removes any information that may be related to the content of the plaintext image and in practice, hinders potential attackers from easily retrieving such information.

6.5. Information Entropy Analysis

In the context of image encryption, information entropy analysis is a technique used in image encryption to measure the level of uncertainty presented in an encrypted image. It quantifies the diversion among pixel values, thus providing useful insights about the complexity of the encrypted image. The entropy of an image X is given by
H ( X ) = i = 1 m n P ( x i ) log 2 P ( x i ) ,
where P ( x i ) represents the probability of pixel x i and m · n is the total number of pixels in an encrypted image. To find the probability distribution P ( x ) , we analyze the frequency of occurrence of each pixel value in the image by (a) counting pixel occurrences, (b) calculating the respective probabilities for each pixel and (c) normalizing probabilities if they do not sum up to one. A grayscale image that achieves an entropy close to 8 confirms the effectiveness of the proposed encryption scheme. Recall that each pixel data has 2 8 = 256 possible values; thus the theoretical entropy value is equal to 8 when pixels appear with the same probability.
Interpreting the results in Table 5, we can state that the average entropy value is greater than 99.99% for all images, which suggests that the proposed algorithm is resistant to statistical analysis and cryptographic attacks.
The current test corroborates previous studies by demonstrating that once the encryption algorithm is deployed, the output images are completely random and reveal no discernible information about the initial plaintext images.

6.6. Differential Attack

In image cryptography, an adversary can potentially exploit the following vulnerability: modify a single pixel or a group of pixels in plaintext and observe the encrypted results. By carefully observing these changes, the adversary can attempt to uncover meaningful relationships between the encrypted images and the plaintext. In this section, we measure the sensitivity of the SBD-Fibonacci algorithm employing two quantitative metrics, the Number of Pixel Change Rate (NPCR), which is given by
NPCR = i = 1 m j = 1 n D i j m n × 100
and the Unified Average Changing Intensity (UACI), which is given by
UACI = 1 m n i = 1 m j = 1 n C 1 ( i , j ) C 2 ( i , j ) 255 × 100 ,
where C 1 is the m × n encrypted image and C 2 is the encrypted image after changing a pixel of the plaintext image. Also, D i j equals 1, when the ( i , j )-th pixels of C 1 and C 2 are different [12,19]. For an 8-bit grayscale image, the ideal average values of NPCR and UACI are 99.6094% and 33.4635%, respectively [44].
The results shown in Table 6 demonstrate that our proposed algorithm is very sensitive to changes in the plaintext image by one pixel and sufficiently secure to resist differential attack.
Differential attacks aim at extracting information about the encryption key through an iterative process of encrypting plaintext images that are slightly changed. The proposed algorithm is robust against such attacks and does not exhibit relevant vulnerabilities.

6.7. Robustness Analysis

To further validate the robustness of the proposed SBD-Fibonacci encryption scheme, we evaluate its performance under noise and cropping attacks, following the methodology in [19]. For noise attacks, salt-and-pepper noise, with a density of 0.01, 0.02, and 0.05, was added to the encrypted images, and the corrupted ciphertexts were then decrypted. We selected the House image of dimensions 1600 × 2400 for experimentation, and Figure 8 demonstrates the overall results. Even when the noise intensity is high (5%) the proposed algorithm can effectively retrieve the original image despite noise corruption, indicating strong robustness.

6.8. Time Complexity

All experiments were carried out on a Linux machine with an 8-core AMD Radeon 7 5825U CPU running at 4.5 GHz, using hyper-threading (16 logical cores). In Table 7, we present the execution time for (a) the SBD scheme, (b) the encryption process, and (c) the entire (total) execution of the SBD-Fibonacci algorithm. We note that our square block division scheme has the minimum time overhead upon the total execution of our program, while the execution of the encryption algorithm process is the most time-consuming part. In cases of images with large dimensions (e.g., Staircase and Josue), a surge in the runtime of the encryption procedure is observed. However, this increase can be compensated by using coarse-grained parallelism, where each thread is tasked with encrypting and decrypting a different group of pixels. Our encryption scheme benefits from this approach, showcasing a runtime reduction of up to 65%. It should be noted that in the total runtime of our scheme, there are parts of the program that cannot be excluded from the calculation due to their functionality, e.g., RGB to grayscale conversion and image reconstruction from the existing blocks.

7. Discussion

In this section, we compare our proposed algorithm with several recently published State-of-the-Art methods found in [9,10,11,13,14,15,18,20,21,24,28,29,30,36,45,46,47]. Using the Lena image from [42], we encrypted it using SBD-Fibonacci at three different sizes: 128 × 128 , 256 × 256 and 512 × 512 . Carrying out 50 repetitions of our algorithm for each image size, we measure the quality and the performance of our encryption process by calculating the Entropy, NPCR, and UACI metrics as defined in Equations (14), (15) and (16), respectively. Taking the mean value for each metric corresponding to Lena’s image size, we present the resulting values in “SBD-Fibonacci” row of Table 8. In addition, Table 8 displays the respective scores obtained by the above references. In addition to that and for the sake of comparison, the “Average” row in the same table contains the mean value calculated from the associated works outlined. Notice that in each category of size and metric, the greater value between the “Average” and “SBD-Fibonacci” rows is highlighted in bold.
As observed in Table 8, the Entropy, NPCR, and UACI values of our method for Lena 256 × 256 are superior compared to the average among the related methods. It is also notable that the SBD-Fibonacci algorithm, by operating the direct sum of different generalized Fibonacci matrices, is more powerful against differential attacks than the one proposed in [9], based on the Kronecker product of the identity matrix with a generalized Fibonacci matrix. The above can be justified by the larger variability of encryption keys produced by the direct sum. For Lena 128 × 128 , we have achieved the highest NPCR score of 99.6459% and the highest UACI score of 33.5420%. Even though in this case the Entropy is not the maximum, it is still effective as it is very close to the ideal theoretical value. Finally, for Lena 512 × 512 our Entropy value coincides with the average of the related works maintaining its effectiveness, while UACI reaches the highest value. On the other hand, NPCR is close to the ideal value. It is worth mentioning that in terms of the Entropy metric, it is evident that the performance of the SBD-Fibonacci algorithm improves as the image size increases, a remarkable attribute that renders SBD-Fibonacci algorithm an appropriate candidate for the encryption of high-resolution images used in modern applications.

8. Conclusions

In this paper, we introduce a novel encryption-decryption approach, termed SBD-Fibonacci, suitable for the encryption of non-square and high-resolution images used in modern applications. This is achieved by a square block division scheme combined with an optimization process that dynamically partitions any input image into optimally sized square blocks to enable efficient encryption without resizing or distortion. The security of this scheme is further enhanced by the Lagrange Four-Square algorithm to eliminate all the small-sized square sub-blocks produced by the block division. The encryption key is generated using the direct sum of powers of generalized Fibonacci matrices, ensuring key matrix invertibility, strong diffusion properties, and security levels. Extensive experiments conducted on a range of commonly used benchmark images indicate that SBD-Fibonacci exhibits high resistance to differential and cryptographic attacks, as well as noise corruption and cropping attacks. Moreover, a comparative analysis of the proposed techniques with some recently published State-of-the-Art algorithms on several metrics demonstrates that SBD-Fibonacci achieves a high level of security. Most notably, its performance improves in terms of the entropy metric as the image size increases, rendering it well-suited for the encryption of high-resolution images. Although SBD-Fibonacci offers significant efficiency in handling non-square images and simplifies key management, there is still room for further improvements. The first next step is to extensively test the proposed algorithm against State-of-the-Art cryptanalysis techniques. In the future, we plan to exploit hybrid methods found in the literature to ameliorate our proposed SBD-Fibonacci image encryption scheme in terms of the encryption complexity of large-scale images and encryption key management. A future goal will also involve the application of parallel computing techniques to optimize computational speed and performance on color image encryption of medical images, multimedia, and real-time image streams.

Author Contributions

Conceptualization, M.A. and P.O.; methodology, M.A., P.O. and G.S.; software, P.O., M.S. and G.K.K.; validation, M.A., P.O., G.S., A.A. and A.K.; investigation, M.A., P.O., A.A., M.S. and G.K.K.; resources, M.A., P.O., M.S. and G.K.K.; data curation, M.A., P.O., M.S. and G.K.K.; writing—original draft preparation; M.A., P.O., M.S. and G.K.K.; writing—review and editing, A.A., G.S. and A.K.; visualization, P.O., M.S. and G.K.K.; supervision, M.A., P.O., A.A., G.S. and A.K. All authors have read and agreed to the published version of the manuscript.

Funding

We acknowledge support of this work by the project “ParICT_CENG: Enhancing ICT research infrastructure in Central Greece to enable processing of Big data from sensor stream, multimedia content and complex mathematical modeling and simulations” (MIS 5047244), which is implemented under the Action “Reinforcement of the Research and Innovation Infrastructure”, funded by the Operational Programme “Competitiveness, Entrepreneurship and Innovation” (NSRF 2014-2020) and co-financed by Greece and the European Union (European Regional Development Fund).

Data Availability Statement

The data that support the findings of this study are openly available in USC-SIPI Image Database of the USC University of Southern California at https://sipi.usc.edu/database/database.php?volume=misc (accessed on 28 August 2023).

Conflicts of Interest

The authors declare no conflict of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Appendix A

Figure A1. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Barbara image.
Figure A1. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Barbara image.
Mathematics 13 01781 g0a1
Figure A2. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Street image.
Figure A2. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Street image.
Mathematics 13 01781 g0a2
Figure A3. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for House image.
Figure A3. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for House image.
Mathematics 13 01781 g0a3
Figure A4. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Staircase image.
Figure A4. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Staircase image.
Mathematics 13 01781 g0a4
Figure A5. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Josue image.
Figure A5. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for Josue image.
Mathematics 13 01781 g0a5

References

  1. Oikonomou, P.; Koziri, M.G.; Tziritas, N.; Dadaliaris, A.N.; Loukopoulos, T.; Stamoulis, G.I.; Khan, S.U. Scheduling video transcoding jobs in the cloud. In Proceedings of the 2018 IEEE International Conference on Internet of Things (iThings) and IEEE Green Computing and Communications (GreenCom) and IEEE Cyber, Physical, and Social Computing (CPSCom) and IEEE Smart Data (SmartData), Halifax, NS, Canada, 30 July–3 August 2018; pp. 442–449. [Google Scholar]
  2. Koziri, M.G.; Papadopoulos, P.K.; Tziritas, N.; Loukopoulos, T.; Khan, S.U.; Zomaya, A.Y. Efficient cloud provisioning for video transcoding: Review, open challenges and future opportunities. IEEE Internet Comput. 2018, 22, 46–55. [Google Scholar] [CrossRef]
  3. Pandey, D.; Nassa, V.K.; Jhamb, A.; Mahto, D.; Pandey, B.K.; George, A.H.; George, A.S.; Bandyopadhyay, S.K. An integration of keyless encryption, steganography, and artificial intelligence for the secure transmission of stego images. In Multidisciplinary Approach to Modern Digital Steganography; Pramanik, S., Ghonge, M.M., Ravi, R.V., Cengiz, K., Eds.; IGI Global: Hershey, PA, USA, 2021; pp. 211–234. [Google Scholar]
  4. Kaur, M.; Singh, S.; Kaur, M. Computational image encryption techniques: A comprehensive review. Math. Probl. Eng. 2021, 2021, 5012496. [Google Scholar] [CrossRef]
  5. Arab, A.; Rostami, M.J.; Ghavami, B. An image encryption method based on chaos system and AES algorithm. J. Supercomput. 2019, 75, 6663–6682. [Google Scholar] [CrossRef]
  6. Karageorgopoulou, A.; Tsoukas, V.; Spathoulas, G.; Kakarountas, A.; Koziri, M. Porting the Paillier Algorithm for Homomorphic Encryption on Portable Devices. In Proceedings of the 2023 IEEE International Conference on Consumer Electronics (ICCE), Las Vegas, NV, USA, 6–8 January 2023; pp. 1–5. [Google Scholar]
  7. Spathoulas, G.; Theodoridis, G.; Damiris, G.P. Using homomorphic encryption for privacy-preserving clustering of intrusion detection alerts. Int. J. Inf. Secur. 2021, 20, 347–370. [Google Scholar] [CrossRef]
  8. Kafetzis, I.; Volos, C.; Nistazakis, H.E.; Goudos, S.; Bardis, N.G. A Real-time Chaos-based Audio Encryption Scheme. In Proceedings of the 2023 12th International Conference on Modern Circuits and Systems Technologies (MOCAST), Athens, Greece, 28–30 June 2023; pp. 1–4. [Google Scholar]
  9. Kranas, G.; Sapounaki, M.; Kampitsis, I.; Oikonomou, P.; Aretaki, A.; Spathoulas, G.; Kakarountas, A.; Adam, M. Enhancing the Hill Cipher Algorithm for Robust and Efficient Image Security. In Proceedings of the the 21st International Conference of Numerical Analysis & Applied Mathematics (ICNAAM, 2023), Crete, Greece, 11–17 September 2023. [Google Scholar]
  10. Qayyum, A.; Ahmad, J.; Boulila, W.; Rubaiee, S.; Masood, F.; Khan, F.; Buchanan, W.J. Chaos-based confusion and diffusion of image pixels using dynamic substitution. IEEE Access 2020, 8, 140876–140895. [Google Scholar] [CrossRef]
  11. Patro, K.A.K.; Acharya, B. A novel multi-dimensional multiple image encryption technique. Multimed. Tools Appl. 2020, 79, 12959–12994. [Google Scholar] [CrossRef]
  12. Feng, W.; Zhang, J.; Qin, Z. A secure and efficient image transmission scheme based on two chaotic maps. Complexity 2021, 2021, 1898998. [Google Scholar] [CrossRef]
  13. Iqbal, N.; Hanif, M. An efficient grayscale image encryption scheme based on variable length row-column swapping operations. Multimed. Tools Appl. 2021, 80, 36305–36339. [Google Scholar] [CrossRef]
  14. Lin, C.M.; Pham, D.H.; Huynh, T.T. Synchronization of chaotic system using a brain-imitated neural network controller and its applications for secure communications. IEEE Access 2021, 9, 75923–75944. [Google Scholar] [CrossRef]
  15. Mfungo, D.E.; Fu, X.; Wang, X.; Xian, Y. Enhancing Image Encryption with the Kronecker xor Product, the Hill Cipher, and the Sigmoid Logistic Map. Appl. Sci. 2023, 13, 4034. [Google Scholar] [CrossRef]
  16. Alloun, Y.; Azzaz, M.S.; Kifouche, A. A new approach based on artificial neural networks and chaos for designing deterministic random number generator and its application in image encryption. Multimed. Tools Appl. 2025, 84, 5825–5860. [Google Scholar] [CrossRef]
  17. Gebereselassie, S.A.; Roy, B.K. Comparative analysis of image encryption based on 1D maps and their integrated chaotic maps. Multimed. Tools Appl. 2024, 83, 69511–69533. [Google Scholar] [CrossRef]
  18. Essaid, M.; Akharraz, I.; Saaidi, A.; Mouhib, e.A. Image encryption scheme based on a new secure variant of Hill cipher and 1D chaotic maps. J. Inf. Secur. Appl. 2019, 47, 173–187. [Google Scholar] [CrossRef]
  19. Feng, W.; Zhang, J.; Chen, Y.; Qin, Z.; Zhang, Y.; Ahmad, M.; Woźniak, M. Exploiting robust quadratic polynomial hyperchaotic map and pixel fusion strategy for efficient image encryption. Expert Syst. Appl. 2024, 246, 123190. [Google Scholar] [CrossRef]
  20. Sivaraman, R.; Rajagopalan, S.; Rayappan, J.B.B.; Amirtharajan, R. Ring oscillator as confusion–diffusion agent: A complete TRNG drove image security. IET Image Process. 2020, 14, 2987–2997. [Google Scholar] [CrossRef]
  21. Zhou, S.; Wang, X.; Zhang, Y.; Ge, B.; Wang, M.; Gao, S. A novel image encryption cryptosystem based on true random numbers and chaotic systems. Multimed. Syst. 2022, 28, 95–112. [Google Scholar] [CrossRef]
  22. Adhikari, S.; Panja, A.; Karforma, S. ICSPRNG: Ikeda assisted Cryptographically Secure Pseudo Random Number Generator. Multimed. Tools Appl. 2025, 84, 5605–5623. [Google Scholar] [CrossRef]
  23. Man, Z.; Li, J.; Di, X.; Liu, X.; Zhou, J.; Wang, J.; Zhang, X. A novel image encryption algorithm based on least squares generative adversarial network random number generator. Multimed. Tools Appl. 2021, 80, 27445–27469. [Google Scholar] [CrossRef]
  24. Hraoui, S.; Gmira, F.; Abbou, M.F.; Oulidi, A.J.; Jarjar, A. A new cryptosystem of color image using a dynamic-chaos hill cipher algorithm. Procedia Comput. Sci. 2019, 148, 399–408. [Google Scholar] [CrossRef]
  25. Tabeidi, R.A.; Morse, H.F.; Masaad, S.M.; Al-shammari, R.H.; Alsaffar, D.M. Create a hybrid algorithm by combining hill and advanced encryption standard algorithms to enhance efficiency of RGB image encryption. In Proceedings of the 12th International Conference on Soft Computing and Pattern Recognition (SoCPaR 2020), Online, 15–18 December 2020; pp. 749–757. [Google Scholar]
  26. Adam, M.; Assimakis, N.; Tziallas, G. Generalized k, m-step Fibonacci sequences and matrices. In Proceedings of the 12th International Conference of AHA-Algebraic Hyperstructures and its Applications, Xanthi, Greece, 2–7 September 2014; Volume 2, pp. 125–134. [Google Scholar]
  27. Prasad, K.; Mahato, H. Cryptography using generalized Fibonacci matrices with Affine-Hill cipher. J. Discret. Math. Sci. Cryptogr. 2022, 25, 2341–2352. [Google Scholar] [CrossRef]
  28. Dişkaya, O.; Avaroğlu, E.; Menken, H.; Emsal, A. A New Encryption Algorithm Based on Fibonacci Polynomials and Matrices. Trait. Signal 2022, 39, 1453. [Google Scholar] [CrossRef]
  29. Hosny, K.M.; Kamal, S.T.; Darwish, M.M.; Papakostas, G.A. New image encryption algorithm using hyperchaotic system and fibonacci q-matrix. Electronics 2021, 10, 1066. [Google Scholar] [CrossRef]
  30. Biban, G.; Chugh, R.; Panwar, A. Image encryption based on 8D hyperchaotic system using Fibonacci Q-Matrix. Chaos Solitons Fractals 2023, 170, 113396. [Google Scholar] [CrossRef]
  31. Mohamed, H.I.; Alhammad, S.M.; Khafaga, D.S.; Komy, O.E.; Hosny, K.M. A New Image Encryption Scheme Based on the Hybridization of Lorenz Chaotic Map and Fibonacci Q-Matrix. IEEE Access 2024, 12, 14764–14775. [Google Scholar] [CrossRef]
  32. Hazzazi, M.M.; Rehman, M.U.; Shafique, A.; Aljaedi, A.; Bassfar, Z.; Usman, A.B. Enhancing image security via chaotic maps, Fibonacci, Tribonacci transformations, and DWT diffusion: A robust data encryption approach. Sci. Rep. 2024, 14, 12277. [Google Scholar] [CrossRef]
  33. Guo, Z.; Chen, S.H.; Zhou, L.; Gong, L.H. Optical image encryption and authentication scheme with computational ghost imaging. Appl. Math. Model. 2024, 131, 49–66. [Google Scholar] [CrossRef]
  34. Miao, M.K.; Gong, L.H.; Zhang, Y.J.; Zhou, N.R. Image encryption and authentication scheme based on computational ghost imaging and lifting wavelet transform. Opt. Lasers Eng. 2025, 184, 108560. [Google Scholar] [CrossRef]
  35. Ye, G.; Guo, L. A visual meaningful encryption and hiding algorithm for multiple images. Nonlinear Dyn. 2024, 112, 14593–14616. [Google Scholar] [CrossRef]
  36. Iqbal, N.; Hanif, M.; Abbas, S.; Khan, M.A.; Rehman, Z.U. Dynamic 3D scrambled image based RGB image encryption scheme using hyperchaotic system and DNA encoding. J. Inf. Secur. Appl. 2021, 58, 102809. [Google Scholar] [CrossRef]
  37. Mansoor, S.; Sarosh, P.; Parah, S.A.; Ullah, H.; Hijji, M.; Muhammad, K. Adaptive Color Image Encryption Scheme Based on Multiple Distinct Chaotic Maps and DNA Computing. Mathematics 2022, 10, 2004. [Google Scholar] [CrossRef]
  38. Fetteha, M.A.; Sayed, W.S.; Said, L.A. A Lightweight Image Encryption Scheme Using DNA Coding and Chaos. Electronics 2023, 12, 4895. [Google Scholar] [CrossRef]
  39. Wen, H.; Lin, Y. Cryptanalysis of an image encryption algorithm using quantum chaotic map and DNA coding. Expert Syst. Appl. 2024, 237, 121514. [Google Scholar] [CrossRef]
  40. Zhang, H.; Kone, M.M.K.; Ma, X.Q.; Zhou, N.R. Frequency-domain attention-guided adaptive robust watermarking model. J. Frankl. Inst. 2025, 362, 107511. [Google Scholar] [CrossRef]
  41. Adam, M.; Aretaki, A. Bounds for the spectral radius of nonnegative matrices and generalized Fibonacci matrices. Spec. Matrices 2022, 10, 308–326. [Google Scholar] [CrossRef]
  42. The USC-SIPI Image Database. Available online: https://sipi.usc.edu/database/database.php?volume=misc (accessed on 28 August 2023).
  43. Unsplash: Beautiful Free Images & Pictures. Available online: https://unsplash.com/ (accessed on 1 July 2023).
  44. Wu, Y. NPCR and UACI randomness tests for image encryption. Cyber J. Multidiscip. J. Sci. Technol. J. Sel. Areas Telecommun. JSAT 2011, 1, 31–38. [Google Scholar]
  45. Karawia, A. Image encryption based on Fisher-Yates shuffling and three dimensional chaotic economic map. IET Image Process. 2019, 13, 2086–2097. [Google Scholar] [CrossRef]
  46. Ahmad, J.; Hwang, S.O. Chaos-based diffusion for highly autocorrelated data in encryption algorithms. Nonlinear Dyn. 2015, 82, 1839–1850. [Google Scholar] [CrossRef]
  47. Wang, X.; Liu, L.; Zhang, Y. A novel chaotic block image encryption algorithm based on dynamic random growth technique. Opt. Lasers Eng. 2015, 66, 10–18. [Google Scholar] [CrossRef]
Figure 1. SBD-Fibonacci flow diagram.
Figure 1. SBD-Fibonacci flow diagram.
Mathematics 13 01781 g001
Figure 2. Square Block Division for different b and p values.
Figure 2. Square Block Division for different b and p values.
Mathematics 13 01781 g002
Figure 3. Square block generation.
Figure 3. Square block generation.
Mathematics 13 01781 g003
Figure 4. Plaintext-encrypted-decrypted images and their histograms (Lena & Barbara).
Figure 4. Plaintext-encrypted-decrypted images and their histograms (Lena & Barbara).
Mathematics 13 01781 g004
Figure 5. Plaintext-encrypted-decrypted images and their histograms (Street & House).
Figure 5. Plaintext-encrypted-decrypted images and their histograms (Street & House).
Mathematics 13 01781 g005
Figure 6. Plaintext-encrypted-decrypted images and their histograms (Staircase & Josue).
Figure 6. Plaintext-encrypted-decrypted images and their histograms (Staircase & Josue).
Mathematics 13 01781 g006
Figure 7. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for the Lena image.
Figure 7. Distributions of adjacent pixel sequence pairs of the plaintext (left) and encrypted image (right) (Horizontal, Vertical, Diagonal) for the Lena image.
Mathematics 13 01781 g007
Figure 8. Decryption results after salt-and-pepper noise attacks, showing the robustness of the SBD-Fibonacci scheme. The first row shows ciphertext images with 0.01, 0.02 and 0.05 salt-and-pepper noise. The second row demonstrates the corresponding decrypted images.
Figure 8. Decryption results after salt-and-pepper noise attacks, showing the robustness of the SBD-Fibonacci scheme. The first row shows ciphertext images with 0.01, 0.02 and 0.05 salt-and-pepper noise. The second row demonstrates the corresponding decrypted images.
Mathematics 13 01781 g008
Table 1. Nomenclature.
Table 1. Nomenclature.
SymbolMeaning
Poriginal image (plaintext) of size m × n
Eencrypted image (or ciphertext)
Ddecrypted image
Kencryption key (key-matrix)
K 1 the inverse matrix of K
Qgeneralized Fibonacci matrix
A B the direct sum of the matrices A , B
b p largest block size divisions
S B list of Square Blocks
ss-th block in S B of size b z × b z , where z [ 0 , p ]
s . r row position in P
s . c column position in P
s . length of s
s . s P sub-image of P associated to s-th block
Lmaster key (list of random values [ 0 , 255 ] )
s L size of master key L
i n d e x current position in L
dthe smallest divisor of b z that is 2
Table 2. Square blocks characteristics.
Table 2. Square blocks characteristics.
Figure 2aFigure 2bFigure 2cFigure 2dFigure 2eFigure 2f
1 × 1 137137203405207401
2 × 2 6767
3 × 3 65
4 × 4 1616 16
5 × 5 82
6 × 6 65
8 × 8 64
9 × 9 13
16 × 16 16 16
25 × 25 4
27 × 27 4
36 × 36 1
Table 3. Images characteristics and selected b , p values.
Table 3. Images characteristics and selected b , p values.
LenaBarbaraStreetHouseStaircaseJosue
Size 512 × 512 472 × 694 2880 × 1920 1600 × 2400 4032 × 3024 6000 × 4000
b16220201810
p282223
Table 4. Correlation between pairs of plaintext and encrypted images.
Table 4. Correlation between pairs of plaintext and encrypted images.
Image (Size)CC(P)-HCC(E)-HCC(P)-VCC(E)-VCC(P)-DCC(E)-D
Lena ( 512 × 512 )0.97190.05800.98500.00590.95930.0044
Barbara ( 472 × 694 )0.91070.05600.95960.00030.8930−0.0003
Street ( 2880 × 1920 )0.97510.03270.9851−0.00010.9661−0.0003
House ( 1600 × 2400 )0.96770.05510.9619−0.00270.94000.0004
Staircase ( 4032 × 3024 )0.98750.15720.9949−0.00810.9848−0.0030
Josue ( 6000 × 4000 )0.99550.14720.9933−0.0018 0.98960.0012
Table 5. Results for entropy in Equation (14) of the encrypted images in Table 3 by SBD-Fibonacci.
Table 5. Results for entropy in Equation (14) of the encrypted images in Table 3 by SBD-Fibonacci.
ImageLenaBarbaraStreetHouseStaircaseJosue
(Size) ( 512 × 512 ) ( 472 × 694 ) ( 2880 × 1920 ) ( 1600 × 2400 ) ( 4032 × 3024 ) ( 6000 × 4000 )
SBD-Fibonacci7.99957.99937.99997.99987.99937.9994
Table 6. Results of NPCR in Equation (15) and UACI in Equation (16) for the images in Table 3 by SBD-Fibonacci.
Table 6. Results of NPCR in Equation (15) and UACI in Equation (16) for the images in Table 3 by SBD-Fibonacci.
ImageLenaBarbaraStreetHouseStaircaseJosue
(Size) ( 512 × 512 ) ( 472 × 694 ) ( 2880 × 1920 ) ( 1600 × 2400 ) ( 4032 × 3024 ) ( 6000 × 4000 )
NPCR (%)99.645299.540599.502199.469098.930799.6090
UACI (%)33.614433.770732.996533.571833.292833.3734
Table 7. Execution Runtime.
Table 7. Execution Runtime.
ImageLenaBarbaraStreetHouseStaircaseJosue
(Size) ( 512 × 512 ) ( 472 × 694 ) ( 2880 × 1920 ) ( 1600 × 2400 ) ( 4032 × 3024 ) ( 6000 × 4000 )
SBD (s)0.000050.000450.001560.000140.001760.00068
Encryption (s)0.315770.313614.664534.022179.2524418.87192
SBD-Fibonacci (s)0.324470.370685.160714.106399.7648119.20553
(Total)
Table 8. Comparison of Entropy, NPCR, and UACI values between SBD-Fibonacci algorithm and other encryption methods for “Lena” image across different sizes.
Table 8. Comparison of Entropy, NPCR, and UACI values between SBD-Fibonacci algorithm and other encryption methods for “Lena” image across different sizes.
SizeAlgorithm RefEntropyNPCRUACI
128 × 128 [45]7.9882--
[28]-99.619033.5000
[15]7.998199.607333.4477
Average7.993299.613233.4739
SBD-Fibonacci7.990599.645933.5420
256 × 256 [45]7.997299.610031.5400
[36]7.595499.630233.4277
[30]7.997499.610933.4347
[46]7.980199.360032.7200
[47]7.997099.580033.2533
[10]7.997399.610033.4900
[11]7.997499.625933.4718
[29]7.997299.624633.4226
[13]7.997499.594133.4719
[20]7.997299.623130.9135
[21]7.997799.600033.4500
[15]7.899399.689133.3272
[9]7.997099.536231.3218
Average7.962499.583832.8264
SBD-Fibonacci7.997599.679633.3978
512 × 512 [45]7.9992--
[11]7.999499.627333.4691
[29]7.999399.617433.4322
[14]7.999899.620033.4700
[18]7.999899.645333.4733
[24]7.999699.745333.5232
Average7.999599.651033.4735
SBD-Fibonacci7.999599.645233.6144
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Oikonomou, P.; Kranas, G.K.; Sapounaki, M.; Spathoulas, G.; Aretaki, A.; Kakarountas, A.; Adam, M. Square-Based Division Scheme for Image Encryption Using Generalized Fibonacci Matrices. Mathematics 2025, 13, 1781. https://doi.org/10.3390/math13111781

AMA Style

Oikonomou P, Kranas GK, Sapounaki M, Spathoulas G, Aretaki A, Kakarountas A, Adam M. Square-Based Division Scheme for Image Encryption Using Generalized Fibonacci Matrices. Mathematics. 2025; 13(11):1781. https://doi.org/10.3390/math13111781

Chicago/Turabian Style

Oikonomou, Panagiotis, George K. Kranas, Maria Sapounaki, Georgios Spathoulas, Aikaterini Aretaki, Athanasios Kakarountas, and Maria Adam. 2025. "Square-Based Division Scheme for Image Encryption Using Generalized Fibonacci Matrices" Mathematics 13, no. 11: 1781. https://doi.org/10.3390/math13111781

APA Style

Oikonomou, P., Kranas, G. K., Sapounaki, M., Spathoulas, G., Aretaki, A., Kakarountas, A., & Adam, M. (2025). Square-Based Division Scheme for Image Encryption Using Generalized Fibonacci Matrices. Mathematics, 13(11), 1781. https://doi.org/10.3390/math13111781

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop