# Separable Data-Hiding Scheme for Encrypted Image to Protect Privacy of User in Cloud
## 3 Proposed Scheme
### Data-Hiding Procedure  
Each measurement value can be quantized into 1 of 256 levels by an 8-bit non-uniform quantization and then encoded into an eight-bit codeword adapted to the [0, 255] grayscale range for the image. Figure 4 shows an eight-bit codeword that represents the measurement, and the data hiding can be performed during the quantization and encoding procedure.  
Assume \(S=\left\{s_{1},s_{2},\ldots,s_{r}\right\}\), where \(r=l\times m\), is a bit stream that is to be hidden. All of the measurements were normalized and converted into the sampling level \(q_{i}^{j}\) from 0 to 2048, according to Equation (4):  
\[q_{i}^{j}=\frac{y_{i}^{j}}{\max(y)}\times 2048,\;i=1,2,\ldots,l;j=1,2,\ldots,m. \tag{4}\]  
First, the polarity shown in Figure 4 must be obtained from Equation (5):  
\[\mathrm{P}=\left\{\begin{array}{ll}1,&\text{if $q_{i}^{j}$ is positive}\\ 0,&\text{if $q_{i}^{j}$ is negative}\end{array}\right.. \tag{5}\]  
Then, two steps, i.e., the segment and the position in the segment shown in Figure 4, must be finished to obtain an 8-bit codeword that has a hidden bit. Figure 5 shows the encoding and hiding processes.  
_Step 1. Segment_. Assume the segment where \(\left|q_{i}^{j}\right|\) is located (i.e., position \(p_{1}\)) and determine the appropriate 3-bit code in the table in Figure 5.  
\[p_{1}=\left\{\begin{array}{ll}0,&\text{if $\left|q_{i}^{j}\right|<16$}\\ \left|\log_{2}\right|\!\!\left|q_{i}^{j}\right|\right|-3,&\text{if $\left|q_{i}^{j} \right|\geq 16$}\end{array}\right., \tag{6}\]  
where \(\left|\cdot\right|\) indicates that the value will be rounded down to the nearest integer.  
Then, recode the interval of the current segment into \(\left[a,b\right]\):  
\[\left[a,b\right)=\left\{\begin{array}{ll}\left[2^{0},2^{p_{1}+4}\right),& \text{if $p_{1}=0$}\\ \left[2^{p_{1}+3},2^{p_{1}+4}\right),&\text{if $p_{1}\
eq 0$}\end{array}\right.. \tag{7}\]  
Figure 4: An eight-bit codeword that represents the measurements.  
Step 2 Position in the segmentThe LSBs indicate the quantized value of the sampling level inside one of the segments. Thus, each segment is divided into a linear fashion into 16 quantum levels. The numbers from 0 to 15 are used to denote the position \(p_{2}\) in a segment. So, the position \(p_{2}\) of the sampling level \(\left|q_{i}^{j}\right|\) in a segment can be computed using Equation (8):  
\[p_{2}=\left\lfloor\frac{16\times(\left|q_{i}^{j}\right|-a)}{b-a}\right\rfloor. \tag{8}\]  
Next, different rules must be used to achieve data hiding, as shown in Step 2 of Figure 5. And before hiding, the random seed is used as data-hiding key \(K_{2}\) to rearrange bits in the bitstream.  
Rule 1: When \(p_{2}=0\) or \(p_{2}=15\), if the bit to be hided \(s_{k}\
eq p_{2}\)mod2, then move \(p_{2}\) to the right or left by 1. Otherwise, there is nothing to do. The purpose of this operation is to ensure that the shifting of the quantized interval occurs within the segment in order to reduce the modification of the measurements.  
Rule 2: When \(p_{2}\) is in the range of 1 to 14, further judgement is needed if the bit that is to be hidden is \(s_{k}\
eq p_{2}\)mod2. Otherwise, there is nothing to do. Through the shifting of position \(p_{2}\), we can embed one bit into one measurement.  
\[p_{2}=\begin{cases}p_{2}+1,&\text{if }\left|q_{i}^{j}\right|>=a+\frac{(b-a)}{16 }(p_{2}+\frac{1}{2})\\ p_{2}-1,&\text{if }\left|q_{i}^{j}\right|<a+\frac{(b-a)}{16}(p_{2}+\frac{1}{2}) \end{cases}. \tag{9}\]