## 3 Algorithms of Data Packing and Unpacking for MCDDC  
The MCDDC data packaging process is the first step of data encryption process. Input digital information is packed into a series of MCDDC, which are then displayed on the first LC SLM. The process is illustrated by Figure 3.  
Figure 3: The algorithm of MCDDC data packing.  
Figure 2: Higher density of data encoding in MCDDC compared to QR code.  
Step 1. Parameters Setting and Definition  
At this step, the user sets the parameters of MCDDC: the message size, BCH error correction level, the number of gray levels, and the width of the fuzzy outline and also selects the file with data for packing. According to the selected values, BCH coefficients are determined. After reading the file, its length in bits is determined; based on which and taking into account the specified parameters of MCDDC, the number of messages is calculated.  
Step 2. Data encoding and message filling  
All the information received at the previous step, both service and useful data, is converted into a bit format.  
The bit values of the parameters are encoded by highly error-tolerant BCH [255,13] (up to 59 errors out of 255 bits can be corrected in any single block). Then, the encoded sequences are assembled into a 52 \(\times\) 64 block, which is placed in the center of the first message.  
The data for packaging is divided into fragments, the length of which is determined by selected BCH, and is encoded.  
After all the data have been encoded, they are combined into a single string, translated into a multibit representation (correspondingly to the selected number of gray levels) and scrambled. Messages are filled in line by line, starting from the upper-left corner.  
Step 3. Applying a fuzzy outline  
A fuzzy outline with the number of gray levels corresponding to the data area is added to each message (if the use of a fuzzy outline is selected). The outline is generated randomly; its maximum width corresponds to the value selected by the user.  
The unpacking is the last step of data decryption process. It is performed after an encrypted MCDDC image is decrypted, its raster transformed to the original one, and quantization is performed. It is a reverse to the packing process which allows one to extract digital information from the decrypted image. The process is illustrated by Figure 4.  
Step 1. Obtaining encoded service information from the first message  
Since the service information block is located in the center of the first message and has a fixed size, the information can be extracted even without knowing the exact size of the message or a fuzzy outline width.  
Step 2. Decoding of the service information and determination of MCDDC parameters  
The obtained information is decoded and checked to see if all the errors that occurred during decoding were corrected (BCH allows to gather information about the presence of uncompensated errors). In the case of error-free decoding, MCDDC parameters are determined.  
Figure 4: The algorithm of MCDDC data unpacking.  
Step 3. Data decoding  
Based on the parameters values, obtained during Step 2 (message size), a fuzzy outline is discarded. Encoded useful data are read from the messages. The correct order of the data is restored. For multilevel grayscale CDDC, a return to the binary representation is performed. Next, the data are divided into fragments in accordance with BCH parameters and decoded.  
Step 4. Recording of the reconstructed file  
After decoding all messages, the data extracted from them are collected into a single file. The resulting file is recorded.  
Unlike for the service block, the occurrence of uncorrected errors in the useful data does not interrupt the execution of the algorithm. If the number of such errors is small, then the packed file can be reconstructed, although with some damage.