# Hamming Code Strategy for Medical Image Sharing
## 3 Hamming Codes
### Using (15,11) Hamming Code
Pixels \(P_{1}\) and \(P_{2}\) are reconstructed as follows:  
\(P_{1}=[i_{1,1}\;i_{1,2}\;i_{1,3}\;i_{1,4}\;i_{1,5}\;i_{1,6}\;i_{1,7}\;i_{1,8}]\)  
\(=[d_{1}\;d_{2}\;d_{3}\;d_{4}\;d_{5}\;d_{6}\;d_{7}\;d_{8}]\),  
and  
\(P_{2}=[i_{2,1}\;i_{2,2}\;i_{2,3}\;i_{2,4}\;i_{2,5}\;i_{2,6}\;i_{2,7}\;i_{2,8}]\)  
\(=[d_{9}\;d_{10}\;d_{11}\;x^{\prime}{}_{1}\;x^{\prime}{}_{2}\;x^{\prime}{}_{3} \;x^{\prime}{}_{4}\;o_{2,8}]\). **Theorem 2:** The proposed scheme based on (15,11) Hamming code is a (2,2) secret sharing scheme. **Proof:** 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 Shadows generation algorithm), there are the following three cases. Case 1: Shadow \(S_{\rm j}\) has the pixel \([d^{\prime}{}_{9}\;d^{\prime}{}_{10}\;d^{\prime}{}_{11}\;p^{\prime}{}_{1}\;p^{ \prime}{}_{2}\;p^{\prime}{}_{3}\;p^{\prime}{}_{4}\;i_{\rm j,8}]\):  
By a similar approach used in proving Theorem 1, the value of \((x_{1}\;x_{2}\;x_{3}\;x_{4})\) cannot be obtained. Thus, 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}\;d^{ \prime}{}_{5}\;d^{\prime}{}_{6}\;d^{\prime}{}_{7}\;d^{\prime}{}_{8}]\) with one error:  
By a similar approach in proving Theorem 1, we cannot obtain the correct codeword \([p_{1}\;p_{2}\;p_{3}\;p_{4}\;d_{1}\;d_{2}\;d_{3}\;d_{4}\;d_{5}\;d_{6}\;d_{7}\;d _{8}\;d_{9}\;d_{10}\;d_{11}]\) to locate the position of error in \((d^{\prime}{}_{1}\;d^{\prime}{}_{2}\;d^{\prime}{}_{3}\;d^{\prime}{}_{4}\;d^{ \prime}{}_{5}\;d^{\prime}{}_{6}\;d^{\prime}{}_{7}\;d^{\prime}{}_{8})\). So, the pixel values are 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}\;d^{ \prime}{}_{5}\;d^{\prime}{}_{6}\;d^{\prime}{}_{7}\;d^{\prime}{}_{8}]\) without error:  
These two pixels \((d^{\prime}{}_{1}\;d^{\prime}{}_{2}\;d^{\prime}{}_{3}\;d^{\prime}{}_{4}\;d^{  
In (7,4) Hamming algorithm, up to 4 bits were manipulated in each pixel; thus, we could choose which group of bits to use, whether it is LSBs, MSBs, or in the middle of the pixels. For each pair of original images, three pairs of shadows were created. The first shadow pair was constructed using the least significant bits (LSBs) in each pixel. The second pair was produced using the middle bits of the pixels. And the last pair was generated using the most significant bits (MSBs). (15,11) Hamming code did not generate the same choices as (7,4) Hamming. We used full 8 bits of a pixel from one original image and 7 bits of a pixel from the other image to construct shadows and reconstruct original images; thus, we were only allowed to choose the group of 7 bits either from LSBs or from MSBs. The goal of our scheme was to produce shadows that look much different from the original ones; the less similarity between the original and shadow images, the better the result achieved. Even though the shadows resembled the original medical images, the details of those images, however, were smeared badly that would not be used in diagnosis or would leak patients' confidential health information. To evaluate the results, we computed the peak signal-to-noise ratio (PSNRs) for each shadow. The higher the PSNR, the more similarity between the shadow and the original image. Therefore, the lower the PSNR the more secure our scheme is. Table 1 shows that using (7,4) Hamming with LSBs yields PSNRs in the range from 40 dB to 45 dB. Manipulating the middle bits results in PSNRs from 23 dB to 27 dB. If we choose to use MSBs, the resulted PSNRs are between 13 dB and 19 dB, which is less than a third of the PSNRs if we choose to use LSBs, and a half of those if  
the other groups of bits in pixels. The shadow images produced by using MSBs have their details blurred out thoroughly.