# Hamming Code Strategy for Medical Image Sharing
## 3 Hamming Codes
### Using (7,4) Hamming Code
In the following theorem, we theoretically prove that our scheme based on (7,4) Hamming code is a (2,2) secret sharing scheme satisfying the threshold condition, which only two shadows \(S_{1}\) and \(S_{2}\) can collaborate to recover the original images \(I_{1}\) and \(I_{2}\). Meanwhile, any one shadow \(S_{1}\) (respectively, \(S_{2}\)) cannot obtain the original image \(I_{1}\) (respectively, \(I_{2}\)). **Theorem 1:** The proposed scheme based on (7,4) Hamming code is a (2,2) secret sharing scheme. **Proof:** To prove that the proposed scheme is a (2,2) secret sharing scheme, we have to prove the security condition (any one shadow cannot obtain its original image), and the threshold condition (two shadows can collaborate together to recover both original images). Figure 2: Original image reconstruction process using (7,4) Hamming code. We first prove the security condition that any one shadow \(S_{\rm j}\) (\(j=1\) or \(2\)) cannot obtain the original image \(I_{\rm j}\). Because \(P_{1}\) and \(P_{2}\) are selected alternately from medical images \(I_{1}\) and \(I_{2}\) (see Step 4 in the shadows generation algorithm), there are the following three cases. Case 1: Shadow \(S_{\rm j}\) has the pixel \([p^{\prime}{}_{1}\ p^{\prime}{}_{2}\ p^{\prime}{}_{3}\ i_{4}\ i_{5}\ i_{6}\ i_{7}\ i_{8}]\):  
No matter the single error occurs in which bit of \([p_{1}\ p_{2}\ p_{3}\ d_{1}\ d_{2}\ d_{3}\ d_{4}]\), information of \((p^{\prime}{}_{1}\ p^{\prime}{}_{2}\ p^{\prime}{}_{3})\) is completely unrelated to information of \((x_{1}\ x_{2}\ x_{3})\), i.e., the original \((i_{\rm j,1}\ i_{\rm j,2}\ i_{\rm j,3})\). Also, in this case, we do not have \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\). Thus, we cannot obtain the correct codeword \([p_{1}\ p_{2}\ p_{3}\ d_{1}\ d_{2}\ d_{3}\ d_{4}]\) to further locate the position of error. So, the value of \((x_{1}\ x_{2}\ x_{3})\) cannot be obtained and the pixel value is different from the original one. Case 2: Shadow \(S_{\rm j}\) has the pixel \([d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4}\ i_{5}\ i_{6}\ i_{7}\ i_{8}]\) and the error occurs in \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\):  
The two 4-tuple \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\) and \((d_{1}\ d_{2}\ d_{3}\ d_{4})\) differ from one bit. For this case, there is no \((p^{\prime}{}_{1}\ p^{\prime}{}_{2}\ p^{\prime}{}_{3})\). Thus, the correct codeword \([p_{1}\ p_{2}\ p_{3}\ d_{1}\ d_{2}\ d_{3}\ d_{4}]\) cannot be obtained to locate the position of the error in \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\). So, we do not have the correct \((d_{1}\ d_{2}\ d_{3}\ d_{4})\) and thus the pixel value is different from the original one. Case 3: Shadow \(S_{\rm j}\) has the pixel \([d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4}\ i_{5}\ i_{6}\ i_{7}\ i_{8}]\) without the error in \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\):  
These two 4-tuple \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\) and \((d_{1}\ d_{2}\ d_{3}\ d_{4})\) are the same, and thus the pixel value on shadow is the same as the original pixel. The pixels \(P_{1}\) and \(P_{2}\) are selected alternately from the medical images \(I_{1}\) and \(I_{2}\). There are 50% (\(\cdot\)\(\cdot\) = 4/8) probability for Case 1. The value of \((x_{1}\ x_{2}\ x_{3})\) causes the error to occur in \((d^{\prime}{}_{1}\ d^{\prime}{}_{2}\ d^{\prime}{}_{3}\ d^{\prime}{}_{4})\) with 50% probability, and causes the error to occur in \((p^{\prime}{}_{1}\ p^{\prime}{}_{2}\ p^{\prime}{}_{3})\) and no error with 50% (\(\cdot\)\(\cdot\) = 3/8+1/8) probability. Therefore, all the pixels of the shadow \(S_{\rm j}\) (j= 1 or 2) have probabilities of 50%, 25% and 25% for Case 1, Case 2 and Case 3, respectively. Finally, there are 75% of pixels different from the original pixels.