Data Hiding Method Based on 3D Magic Cube

Medical records are extremely sensitive information and may cause a violation of patients’ rights if the data is captured or altered. Such data requires uncompromising security during transmission or when the data is stored in medical datacenters. The most commonly used procedure is to hide sensitive information inside a cover medium without incurring any increase in data size or computational overhead. Even though many steganography techniques have been proposed in recent years, only a few have addressed issues related to protecting medical data. In this paper, we proposed a data hiding method based on magic cube generated using magic matrix. In the proposed method, 9 bits of secret data were embedded in each group of 4 pixels using secret keys that scattered values in the square template to make it more unpredictable. Experimental results showed that the proposed method achieved an embedding capacity of 2.25 bpp and an average PSNR of 44 dB outperforming previous methods.


I. INTRODUCTION
Medical information in the form of images comprises at least 90% of all the data in medical centers and hospital systems [1]. Medical records (i.e. medical images, medical records etc.) are extremely sensitive patient information and if the data is captured or altered due to cybercrime, it may cause a violation of patients' rights and changes in medical treatment. Such data is often times transmitted to/from other hospitals or medical centers to improve the diagnostic outcomes and communicate to study a therapeutic patient [2]. Therefore, all patient records, especially medical images, require uncompromising security while data is being transmitted using the public network and also when the data is stored in the medical data center servers monitored by remote systems [3], [4]. Traditionally, private data was protected by using cryptographic methods. However, the downside of cryptography is that it makes the message suspicious enough to attract malicious attention. Alternatively, medical data can also be protected by using steganography techniques.
Steganography deals with concealing the fact that a message carries hidden content (images, files, audio, and video) The associate editor coordinating the review of this manuscript and approving it for publication was Jinming Wen .
using a cover medium. The advantage of steganography is that the secret messages carried by the stego image cannot easily attract malicious attention. In other words, it becomes difficult for humans to perceive the secret data in stego-image after it is hidden. Usually, medical records such as X-ray, Computed Tomography (CT), Magnetic Resonance Imaging (MRI), ultrasound, etc. are handled, stored, and transmitted using the Digital Imaging and Communications in Medicine (DICOM) standard. The DICOM standard enables integration between devices, software, and platforms into a picture archiving and communication system (PACS). The DICOM format identifies a header that stores metadata of every image such as image size, data type, representation, etc . . .) and patient information, exam, modality, acquisition parameters, physician, and health center [1], [5], [6]. The patient information in DICOM file must be securely stored within the network to avert tampering, illicit copying, and patient privacy disclosures to ensure copyright protection, and other information related security issues [7].
As the objectives of steganography are imperceptibility, robustness, embedding capacity of the hidden message, and resistance to tampering, the most commonly used procedure is to hide sensitive information inside a cover medium without incurring any increase in the data size and additional VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see http://creativecommons.org/licenses/by/4.0/ computational overhead. Considering these objectives, many information hiding techniques based on images have been discussed and studied in recent decades [8]- [11]. In 2004, Chan and Cheng proposed Least Significant Bit (LSB) substitution method [7] in which last 1 to 4 values of a binary cover pixel were replaced with secret data. The drawback of this method was that even though it had a high Embedding Rate (ER) and low distortion level, it was easy to detect the hidden information, making the security of hidden messages poor. In 2006, Zhang and Wang proposed Exploiting Modification Direction (EMD) method [12] which used an import extraction function. The secret message was first represented in (2n + 1)-ary representation system and was then carried by n cover pixels, where n was a system parameter.  [14] which mainly involved calculating the difference between two pixel pairs. It used an interval scale to determine the length of the secret message that could be hidden. Thereafter, the secret message was embedded by modifying the two pixels. Because the variation was by two pixels, the relative distortion was less. Using this method, the average PSNR value achieved was 40.7 dB, and the ER was 1.5 to 1.6 bpp, depending on the length of interval scale respectively. In 2014, Chang et al. suggested a data hiding method based on turtle shell [15]. This method used a magic matrix to embed secret messages which achieved a PSNR and ER of 49.4 dB and 1.5 bpp, respectively. In 2008, Chang et al. proposed a method that used magic matrix and the characteristics of Sudoku [16]. This method achieved a PSNR and ER of 44.85 dB and 1.5 bpp, respectively. In 2015, Kurup et al. proposed a method based on an octagon shell [17]. This method used a magic matrix to embed secret messages and achieved a PSNR and ER of 51.7 dB and 2 bpp respectively. In 2017, Lee et al. proposed a method based on magic square [18] which achieved a PSNR and ER of 44.12 dB and 2 bpp, respectively. In 2018, Lee and Wang proposed a method based on magic signet [19]. The magic signet hiding method was based on a 4 × 4 two-dimensional matrix, where values from 0 to 15 were randomly generated in the signet. Secret messages for every 4 bits were carried by two pixels to achieve an average PSNR and ER of 44.12 dB and 2 bpp, respectively. The matrix in the above method was mostly constructed in a 2D manner; i.e. the x-axis and the y-axis of the matrix were constructed by a pair of pixels. Thereafter, replacement of coordinate positions was used to embed secret messages. In this paper, a new method based on 3D magic cube is proposed to achieve a higher ER and a good image quality. The proposed method is different from the previous methods based on the 2D matrix as it can be used to hide more secret messages (higher EC) while maintaining an acceptable image quality. The results show that the PSNR ranged from 41.55 to 43.71 dB at a fixed embedding rate of 2.25. The images still maintained a good visual quality at a fixed embedding rate. The proposed method also achieved an embedding capacity of 2.25 bpp and an average PSNR of 43 to 44 dB for nine standard test images. Moreover, the proposed method showcased better imperceptibility than methods [23] and [24] and the ER exceeded than methods [17], [19], [20], and [22] by more than 0.25 bpp. Therefore, the proposed method has more advantages compared to the previous methods. In the next section, we will introduce several related works.

II. RELATED WORKS
A. DATA HIDING SCHEME BASED ON TURTLE-SHAPED SHELLS In 2014, Chang et al. developed a data hiding scheme based on turtle-shaped shells [15]. In their method, the secret data was represented in a binary format, 3 bits of which were embedded within every 2 pixels. Fig. 1 presents a magic matrix M of size 256 × 256 based on turtle-shaped shells. In the matrix M , two adjacent elements in the same row have a difference of 1, and two neighboring elements present in the same column have an alternating difference of 2 and 3.
Let M (p i , p i+1 ) and M (q i , q i+1 ) be two numbers in the magic matrix M , where (p i , p i+1 ) and (q i , q i+1 ) represent the pairs of cover pixels and stego pixels, respectively. This is before/after a 3-bit secret data s i has been concealed.
If the number M (p i , p i+1 ) falls in a turtle-shaped shell, then the secret number s i also can be found in the same turtle-shaped shell, such that ) is a number on the edge, then the number s i can be found in the surrounding three turtle shells. A calculation needs to be done to find the minimum distance between (p i , p i+1 ) and (q i , q i+1 ) under the condition that s i = M (q i , q i+1 ). Another special case occurs when the number M (q i , q i+1 ) is not located in any turtle-shaped shell. The solution, as shown in Fig. 2 is to find the shortest distance between The limitation of the turtle shell scheme [15] was that the ER was limited. Thereafter, Lee et al. [20] proposed an algorithm based on the shape of a pencil to enhance ER while maintaining a good stego image visual quality. In Lee et al.'s method, each cover pixel pair carried a 4-bit secret data, thereby increasing the ER up to 2 bit per pixel (bpp), which was better than the previous techniques. However, compared to the turtle shell scheme, the pencil-shaped scheme involved more image distortion, which went up to 5 dB.

B. SUDOKU-BASED DATA HIDING SCHEME
In 2008 Chang et al. [16] proposed a Sudoku-based data hiding method which is a logic-based digital jigsaw puzzle designed to fill 9 × 9 squares grid with numbers from 1 to 9. In 1979, Garns invented Sudoku, which was released in 1986 by a Japanese publisher Nikoli and became internationally popular. A Sudoku box has nine 3 × 3 subboxes, each containing 1 to 9 digits. Each row and column of the Sudoku grid contains numbers from 1 to 9. Chang et al.'s method based on Sudoku not only improved the ability to hide secret data, but it also improved the security. According to Sudoku's characteristics, each digit in the Sudoku square was decremented by one so that the square contained numbers from 0 to 8. Then it was required to convert the secret data in binary to a base-9 confidential message, and the pixel value was modified. After three candidate elements were obtained, they were compared with the original pixel M (p i , p i+1 ). Obtaining the candidate element M (q i , q i+1 ) with the shortest distance was the final step. This stego pixel pair (q i , q i+1 ) was then used to hide the secret data.

C. DATA HIDING TECHNIQUE BASED ON OCTAGON-SHAPED SHELL
In 2015, Kurup et al. [17] suggested a method based on octagon-shaped shell. An octagon contains numbers from 0 to 15, which represent four secret bits of secret data. In this method, the first step of the hiding process was to generate a 256 × 256 reference matrix. This matrix had two rules. The difference between adjacent pixels in the same row was set to 1 and the difference between two adjacent pixels in the same column was set to 4 or 5. The reference matrix was connected to multiple octagons. Each octagon had 16 numbers, which included 6 numbers in the middle of the octagon and 10 numbers at the edges. After the matrix was generated in the second step, all the elements were divided into two types: general elements and special elements. General elements referred to the middle or edge numbers in the octagonal line, and special elements referred to the numbers that were not located in any octagon. The pixels were modified according to the rules below: is an edge digit included in at least one octagon, then M (q i , q i+1 ) is one of the digits in all octagons that are adjacent.
Rule 3: If M (p i , p i+1 ) does not belong to any octagon, then M (q i ,q i+1 ) is one of all digits in a 4 ×5 sub-block, where M (q i ,q i+1 ) is located in the center of the sub-block.

D. DATA HIDING TECHNIQUE BASED ON SECURE MAGIC SIGNET
Furthermore, in 2018, Lee et al. [20] proposed an image hiding scheme based on secure magic signet which involved procedures such as matrix construction, message embedding, and data extraction. Here, a square template of N 1 ×N 2 digits was first created and then adapted to create a magic matrix of size 256 × 256.

1) CONSTRUCTION OF MAGIC MATRIX
First, a 2D magic matrix was constructed of size H × W which was based on a square template of size h × w. We have used H = W = 256, and h = w = 4 as an example shown in Fig. 3. In hexadecimal representation system, 4 bits is denoted using a single digit. The square template contains N 1 × N 2 digits ranging from 0 to (N 1 × N 2 − 1). The square template is like a seal affixed to the 2D matrix in a non-overlapping manner so that the magic matrix can be created.

2) GENERATION OF SECURE MAGIC SIGNET BY USING SECURE KEYS
A secure key SK 1 was used to generate a square template which generated 16! ≈ 2.1e + 13 templates. Also, VOLUME 8, 2020 another secure key SK 2 was used to locate the start position of the secure magic signet. Due to the usage of SK 1 and SK 2 , the security aspects were determined by a random number. This made the numbers in the 4 × 4 square unpredictable combinations which provided a relatively safer method in terms of security. We will explain the process using a 4 × 4 matrix.
As mentioned before, we first need to build a 256 × 256 magic matrix before performing the embedding procedure. Therefore, a single 4 × 4 square needs to be built first. The role of SK 1 is to generate numbers from 0 to 15 in the 4 × 4 magic square, and there are a considerable number of possible combinations: 16! ≈ 2.1e + 13. The next step is to decide how to stack these 4 × 4 squares, i.e. how to fill these squares among the 256 × 256 carriers. Here, a 4 × 4 square is stacked into a 2D matrix from left to right first and then from top to bottom, until it fills the entire 256 × 256 pixel carriers.
Finally, to enhance the security further, the third secure key SK3 was responsible for shuffling the pixel values of the original image before the original image was hidden. After SK3 modified the original image, a scrambled image was used as a carrier to carry the secret data. Compared to directly embedding a message in the original image, hiding the message in a randomly generated image made it more difficult to detect the existence of a confidential message.

3) EMBEDDING PROCEDURE
Let us consider a secret message S = {s j |j = 1, 2, . . ., (H × W )/2; 0≤s j ≤15}, where every s j is hidden using a pair of pixels, and let I be a grayscale image of height H and width W . Therefore, I = {p i |i = 1, 2, . . ., (H × W ); 0≤p i ≤255}. Before the embedding process, pixels of the original image are shuffled using the third secure key SK 3 by a secure pseudo-random number generator. Fig. 4 shows flow chart of the embedding procedure.
The pixels are then categorized into pairs, so that each pair (p i , p i+1 ) can be considered as a coordinate of the 2D magic matrix. Let M (p i , p i+1 ) and M (q i , q i+1 ) be the numbers in the magic matrix M, where (p i , p i+1 ) and (q i , q i+1 ) represent the pairs of pixels before and after a 4-bit secret number s j has been concealed, respectively. For a given secret digit s j associated to a pixel pair (p i , p i+1 ), the stego pixel pair (q i , q i+1 ) can be resolved by finding the shortest distance between (p i , p i+1 ) and (q i , q i+1 ) under the condition that M (q i , q i+1 ) is equal to the secret data s j . The proposed scheme takes (p i , p i+1 ) as the center location to find the nearest position, where M (q i , q i+1 ) = s j , without considering, whether the entry with the coordinate (q i , q i+1 ) is located within the square matrix or not. This thereby increases the stego image quality.

III. PROPOSED SCHEME
This section introduces the proposed method using an example. First the cover image is divided into 2 × 2 nonoverlapping blocks. Each block is represented by four cover pixels (p 1 , p 2 , p 3 , p 4 ), and the cover pixel value p 1 is located at the upper left-hand corner, p 2 , p 3 , p 4 are located at the upper right-hand, the lower left-hand, and the lower righthand corners, respectively. A partial secret message is hidden into cover pixel value p 1 by using the LSB substitution hiding method and the stego-pixel value becomes q 1 . Then the absolute difference d 1 , d 2 , d 3 of q 1 for p 2, p 3, p 4 is calculated and then contrasted with the coordinate position in the 3D magic cube such that (x, y, z) = (d 1 , d 2 , d 3 ). Each coordinate position (x, y, z) in the magic cube carries a decimal value which is defined as M (d 1 , d 2 , d 3 ).
The general data hiding method uses a matrix of two dimensions. However, to increase the embedding capacity and improve the image quality, a data hiding method based on a 3D magic cube is proposed in this paper. In the embedding procedure, a new coordinate (x , y , z ) is found around the coordinates of (x, y, z) = (d 1 , d 2 , d 3 ). The data s is then carried by finding the position The inversion formula is applied to obtain the stego-pixel values. Thereafter, the original pixel values (p 1 , p 2 , p 3 , p 4 ) are modified to the stego-pixel values (q 1 , q 2 , q 3 , q 4 ).

A. 3D ARRAY CONSTRUCTION PROCEDURE
First, a 3D array is created. Before hiding secret data, 3D coordinate system is used to create a stereoscopic 3D array. The size is N x ×N y × N z , where N x = N y = N z = 256. Then a 3D magic cube is designed according to some rules. The range of its x-axis is 0 ≤ x < n x , the range of its y-axis is 0 ≤ y < n x , and the range of its z-axis is 0 ≤ z < n x . An example of a magic cube with 3D array is displayed in Fig. 5.
To describe this magic cube, n x = n y = n z = 4 is taken as an example. The magic cube is composed of 4 3 = 64 small cubes. Each small cube has a corresponding coordinate (x, y, z) and a magnitude M (x, y, z), where 0 ≤ (x, y, z) ≤ 255 39448 VOLUME 8, 2020  and 0 ≤ M (x, y, z) ≤ 63. Therefore, in the 4 × 4 × 4 magic cube, the coordinates will have numbers 0 to 63 and there will be 64 unrepeated random values. Thereafter, the 256 × 256 × 256 three-dimensional array is filled by stamping the signet. Fig. 6 shows a 4 × 4 × 4 magic cube. One of the number M (3, 3, 0) = 15 is located at the coordinate (3, 3, 0).

B. EMBEDDING PROCEDURE
The cover image I is first divided into 2 × 2 non-overlapping blocks. Each block is represented by four cover pixels (p 1 , p 2 , p 3 , p 4 ). Then a k 1 -bit data s 1 is extracted from the left side of secret message S. Secret data s 1 is hidden into the cover pixel p 1 using the LSB substitution data hiding method to become q 1 . Then three absolute differences d 1 = abs (q 1 , p 2 ) ; d 2 = abs (q 1 , p 3 ) ; d 3 = abs (q 1 , p 4 ) are calculated, where the abs function computes an absolute value such that Next, a k 2 -bit data s 2 is extracted from the remaining secret message and the position ( Thereafter, the relationship is checked between s 2 and the value M (d 1 , d 2 , d 3 ) by applying the following rules: Case (1): If a) The shortest distance is calculated which ). b) Thereafter the stego image pixel values q 2 = q 1 + d 1i , q 3 = q 1 + d 2i , q 4 = q 1 + d 3i are calculated. c) Finally the original pixels (p 1 , p 2 , p 3 , p 4 ) are modified to the stego-pixels (q 1 , q 2 , q 3 , q 4 ). The above steps are repeated until all the secret messages are hidden, and the stego image I is the output. Fig. 7 shows the flow chart of the embedding procedure.

C. ILLUSTRATION OF THE EMBEDDING PROCEDURE
Let us take an example that a secret message S = (11001111) 2 needs to be transmitted through a block with four pixels (p 1 , p 2 , p 3 , p 4 ) = (10, 12, 13, 14) from the original cover image. The embedding procedure can be illustrated as follows as shown in Fig. 8.
First, a 3-bit data s 1 = (110) 2 is extracted from the left side of secret message S. Secret data s 1 is hidden into the cover pixel p 1 using the LSB substitution data hiding method to become q 1 = (00001110) 2 = (14) 10 as shown in Fig. 8(a). Then three absolute difference values, are calculated as shown in Fig. 8(b).

D. MESSAGE EXTRACTION PROCEDURE
The stego image is cut into 2 × 2 non-overlapping blocks, and each block is represented by four cover pixels (q 1 , q 2 , q 3 , q 4 ). First, (q 1 , q 2 , q 3 , q 4 ) of the absolute difference is calculated such that Thereafter, by knowing the coordinate point (d 1 , d 2 , d 3 ), the position values M (d 1 , d 2 , d 3 ) are obtained, which is the secret data s 2 in a decimal form. Then the pixel value on the top left q 1 is used to extract the k 1 -bit secret data s 1 on the rightmost side of q 1 . The secret data s 2 is converted from decimal to binary and s 1 ||s 2 are concatenated. Finally in the last step (k 1 + k 2 )-bit secret data hidden in the block is extracted.

IV. EXPERIMENTAL RESULTS
We used MATLAB R2017a platform to carry out the experiment. To evaluate performance of the proposed method, six medical images were used from the DICOM library [28] as the first set of test images shown in Fig. 9. The medical images had different textures and were applied through DICOM outcome. The second set of test images were  standard grayscale images used from the University of Southern California-Signal and Image Processing Institute (USC-SIPI) image database [21] as shown in Fig. 10. These images included the images of Lena, Baboon, Peppers, Boat, Airplane, Tiffany, Elaine, House, and Pirate.
To avoid subjective evaluation of human vision, a wellknown measurement, peak signal to noise ratio (PSNR) is used to assess the degree of similarity between a hidden image and its original image. The equation for PSNR is defined in the following (1). For (2), the mean square error (MSE for short) stands for the difference between the stego-image and its original image sized H ×W pixels. The higher the value of the peak signal to noise ratio, the better is the image quality, and the embedded secret messages cannot be easily perceived by the human eyes.
Embedded capacity (EC) also called payload is also an important metric to measure embedding performance. EC is measured by the maximum number of embedding bits. We use (3) to define the embedding rate (ER) to represent the maximum number of secret bits embedded in all pixels of (H is the height of image, W is the width of image, I is the original image, and I is the cover image, EC is the embedding capacity.) The proposed 3D cube-based data hiding method is a new method, which is different from the methods based on the 2D matrix. The proposed method increases the EC without much reduction in the image quality. Table 1 showcases the PSNR of six medical test images as seen in Fig. 8. At a fixed embedding rate of 2.25, the PSNR ranged from 41.55 to 43.71 dB. The results show that medical images still maintained a good image quality at a fixed embedding rate.    Table 3 compares the proposed method with the 2D matrix methods of Chang et al. [15], [16], Kurup et al. [17], Lee and Wang [19] and Lee et al. [20], and Xia et al. [22]. The embedding rate of the proposed method is 2.25 bpp. It exceeds the octagon-shape [17], pencil-shape [20], magic signet [19], and 3D-sudoku [22] methods by more than 0.25 bpp. Notwithstanding the increased embedding rate, the PSNR does not reduce considerably. The average PSNR of the proposed method is 44 dB, which is higher than pencil-shape [20] and 3D-sudoku [22] methods. Table 4 shows a comparison of our proposed method with the PVD methods, which include the methods of Khodaei and Faez [23], Jung [24], Mandal and Das [25], Chen [26], and Shen and Huang [27]. The results show that the EC of the proposed method is lower than methods [23] and [24] by about 1 bpp. However, the PSNR is about 6 dB higher. Moreover, it has better imperceptibility than methods [23] and [24]. In addition, the PSNR of the proposed method is higher than methods [25], [26], and [27] by a small difference; however, its embedding rate (bpp) is about 7 dB higher. The method can be used to hide more secret messages while maintaining an acceptable PSNR. Figure 11 shows the PSNR of the methods of Khodaei and Faez [23], Jung [24], Mandal and Das [25], Chen [26], Shen and Huang [27], and the proposed method. The PSNR varies considerably for the test images of Lena, Baboon, Peppers, Boat, and Airplane. The PSNR variation for the Jung's method [24] and the proposed method are relatively stable, compared to Khodaei and Faez [23], Mandal and Das [25], Chen [26], and Shen and Huang [27] methods.

V. CONCLUSION
With the objective to solve issues related to protecting medical data, we proposed a data hiding method in this paper, which is based on magic cube generated using magic matrix. In the proposed method, 9 bits of secret data were embedded in each group of 4 pixels using secret keys, maintaining the image quality at an average of 44.00 db. Compared to other 2D matrix methods, the proposed magic cube method achieved a higher EC and a stable image quality. Currently, there are not many 3D-based data hiding methods and future studies can carry out further research to design a better magic cube to further upgrade the image quality and ER.
CHIN-FENG LEE received the Ph.D. degree in computer science and information engineering from National Chung Cheng University, Taiwan, in 1998. She is currently a Professor of information management with the Chaoyang University of Technology, Taiwan. Her research interests include steganography, image processing, information retrieval, and data mining.
JAU-JI SHEN received the Ph.D. degree in computer science and information engineering from National Taiwan University, Taiwan, in 1988. He is currently a Professor of information management with National Chung Hsing University, Taiwan. His research interests include image techniques, data techniques, and software engineering.
SOMYA AGRAWAL received the Ph.D. degree in technology management from National Chung Hsing University, Taiwan. She is currently a Postdoctoral Researcher with the Department of Information Management, Chaoyang University of Technology, Taiwan. Her research interests include management education, team development, information management, image processing, and information data hiding.
YING-XIANG WANG received the master's degree in information management from the Chaoyang University of Technology, Taiwan. His research interests include image techniques and data hiding.