# An Improved Product Code-Based Data Hiding Scheme
## Appendix A
### 1-D Toggle Syndrome-based Embedding Scheme (1 DTS-1)  
#### a.1.1 Embedding  
_Step 1_: Calculate the syndromes of the seven rows in \(\mathbf{X}\), i.e., \(\mathbf{s}_{i}\) = [\(x_{i,1}\)\(x_{i,2}\)\(\ldots\)\(x_{i,7}\)] \(\times\)\(\mathbf{H}^{\mathrm{T}}\), \(i\) = 1\(\sim\) 7, where (\(\mathbf{s}_{1}\),\(\mathbf{s}_{2}\),\(\mathbf{s}_{3}\),\(\mathbf{s}_{4}\),\(\mathbf{s}_{5}\),\(\mathbf{s}_{6}\),\(\mathbf{s}_{7}\)) is the first embedding channel with 21 bits in total. The toggle syndrome \(\mathbf{t}\mathbf{s}_{i}\) = \(\mathbf{s}_{i}\)\(\oplus\)\(\mathbf{m}_{i}\), \(i\) = 1\(\sim\)7. _Step 2_: Calculate the syndromes of the first four columns in \(\mathbf{X}\), i.e., \(\mathbf{s}_{i}\) = [\(x_{1,i-7}\)\(x_{2,i-7}\)\(\ldots\)\(x_{7,i-7}\)] \(\times\)\(\mathbf{H}^{\mathrm{T}}\), \(i\) = 8\(\sim\) 11. (\(\mathbf{s}_{8}^{\mathrm{T}}\),\(\mathbf{s}_{9}^{\mathrm{T}}\),\(\mathbf{s}_{10}^{\mathrm{T}}\),\(\mathbf{s}_{11}^{\mathrm{T}}\)) is the second embedding channel with 12 bits in total. The toggle syndrome \(\mathbf{t}\mathbf{s}_{i}\) = \(\mathbf{s}_{i}\)\(\oplus\)\(\mathbf{m}_{i}\), \(i\) = 8\(\sim\) 11. From Table 1, respectively find the corresponding coset leaders \(\mathbf{e}_{i}\) (i.e., the toggle sequence \(\mathbf{t}_{i}\)), \(i\) = 8\(\sim\) 11. The four toggle sequences (placed in an upright form) constitute a 7 \(\times\) 4 array with each row denoted as \(\mathbf{f}_{i}\), \(i\) = 1\(\sim\)7. _Step 3_: Make the syndromes of the seven rows and the first four columns of the resultant stego array after embedding respectively equal \(\mathbf{m}_{1}\), \(\mathbf{m}_{2}\), \(\mathbf{m}_{3}\), \(\mathbf{m}_{4}\), \(\mathbf{m}_{5}\), \(\mathbf{m}_{6}\), \(\mathbf{m}_{7}\), and \(\mathbf{m}_{8}\), \(\mathbf{m}_{9}\), \(\mathbf{m}_{10}\), \(\mathbf{m}_{11}\). For the toggle sequence \(\mathbf{t}_{i}\), \(i\) = 1\(\sim\) 7, instead of finding the coset leaders of the cosets to which \(\mathbf{t}\mathbf{s}_{i}\), \(i\) = 1\(\sim\) 7, respectively belongs, they are found by the lookup of Table A1 with the rule that the first four bits of \(\mathbf{t}_{i}\) and the four bits of \(\mathbf{f}_{i}\) are equal. Those seven toggle sequence \(\mathbf{t}_{i}\), \(i\) = 1\(\sim\) 7, constitute a toggle array \(\mathbf{T}\) of size 7 \(\times\) 7. _//_ The following proposed one-off decision technique is used to reduce the number of 1s in \(\mathbf{T}\). _Step 4_: To reduce the number of 1s in \(\mathbf{T}\), first check the seven rows of \(\mathbf{T}\) and whether there is more than one row with a Hamming weight in each row of greater than 2. If it does not exist, jump out to the next step. Otherwise, suppose there are \(N\) rows (\(N\in\) [2 \(\ldots\) 7]), each of which has a Hamming weight greater than 2, and two rows are chosen randomly at a time. Hence, there are \(C_{2}^{N}\) different row combinations. For each of those row combinations, do:  
Take the component-wise OR operation among those rows to obtain a new vector \(\mathbf{u}\). Then, utilizing the lookup of Table 1, find a codeword \(\mathbf{c}\) which is closest to \(\mathbf{u}\) in terms of minimal Hamming distance. Add sequentially the codeword \(\mathbf{c}\) to each of those rows. Then, it is very likely some of the first four columns of \(\mathbf{T}\) have been changed. Let \(\mathbf{w}\) be the induced non-zero vector with the non-zero component denoting the changed position of any changed column. From Table 1, find the coset leader \(\mathbf{e}\) of the coset to which the vector \(\mathbf{w}\) belongs. Hence, to keep the syndromes unchanged for the first four columns of the toggle array, we need to add \(\mathbf{e}\) respectively to those changed columns. Suppose the bit 1 is located in the \(i\)-th component of \(\mathbf{e}\), hence once codeword \(\mathbf{c}\) is also added into the \(i\)-th row of \(\mathbf{T}\), then all of the syndromes of the seven rows and the first four columns of the new toggle array remain the same as \(\mathbf{T}\). Denote the new toggle array as \(\mathbf{T}^{\prime}\).