# Hamming Code Strategy for Medical Image Sharing

^{1}

^{2}

^{3}

^{4}

^{5}

^{6}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related Works

## 3. Hamming Codes

^{m}− 1. Hamming code has a minimum Hamming distance 3, and thus it can correct one single error. For example, for m = 3, the code length is 7 bits in which there are three parity bits and four data bits; this code is called (7,4) Hamming code. Similarly, (15,11) Hamming code has four parity bits and eleven data bits. The number of data bits increases exponentially as the number of parity bits grows.

**H**of Hamming code consists of all non-zero m-tuple 2

^{m}as its columns (i.e., 2

^{m}− 1 columns). Suppose that the parity-check matrix is

**H**= [I

_{m}Q], where I

_{m}is an m × m identity matrix and

**Q**is an m-tuple with weight two or more. Then the generator matrix is

**G**= [Q

^{T}I

_{n−m}], where

**G**×

**H**= [0]

^{T}_{m}

_{×(n−m)}. In this paper, our approach adopts (7,4) Hamming code and (15,11) Hamming code. The following two examples show how to encode and decode for these two Hamming codes, respectively.

**Example 1.**

**H**is a 3 × 7 matrix and

**G**is a 4 × 7 matrix, as shown below. Obviously, one can easily verify

**G**×

**H**= [0]

^{T}_{4×3}.

_{1}, d

_{2}, d

_{3}and d

_{4}) are at the most right 4 bits, and others are parity bits. To encode a 4-bit data d = [d

_{1}d

_{2}d

_{3}d

_{4}] into a 7-bit codeword c, the following equation is applied:

_{1}p

_{2}p

_{3}d

_{1}d

_{2}d

_{3}d

_{4}].

_{1}= d

_{1}⊕d

_{3}⊕d

_{4}, p

_{2}= d

_{1}⊕d

_{3}⊕d

_{4}, and p

_{3}= d

_{2}⊕d

_{3}⊕d

_{4}. It is observed that there are at least 2 parity bits covering a data bit, so even a parity bit is flipped we still can detect and correct it. For example, suppose that the data is d = [0 1 0 1], then p

_{1}= 1, p

_{2}= 1 and p

_{3}= 0; the codeword is c = [1 1 0 0 1 0 1]. For decoding, the syndrome, a 3-tuple, is computed as

^{T}= [s

_{3}s

_{2}s

_{1}].

_{3}, s

_{2}, s

_{1}) = c′ ×

**H**. If the syndrome is a zero vector [0 0 0], the codeword is correct; otherwise, the syndrome (s

^{T}_{3}s

_{2}s

_{1}) can be used for correcting one error. For the received word c′ = characteristic [1 1 1 0 1 0 1], the syndrome vector [s

_{3}s

_{2}s

_{1}] equals to [0 0 1]. The 3-tuple (0 0 1) is the third row in HT, and thus the bit p

_{3}(the position is 3 from left) should be flipped. The correct codeword is [1 1 0 0 1 0 1].

**Example 2.**

**H**and 11 × 15 generator matrix

**G**are shown below.

_{1}d

_{2}d

_{3}d

_{4}d

_{5}d

_{6}d

_{7}d

_{8}d

_{9}d

_{10}d

_{11}] can be encoded into a systematic 15-bit codeword c = d∗G = [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}], where the parity bits are computed as follows:

_{1}= d

_{1}⊕d

_{2}⊕d

_{4}⊕d

_{7}⊕d

_{8}⊕d

_{9}⊕d

_{11},

_{2}= d

_{1}⊕d

_{3}⊕d

_{5}⊕d

_{7}⊕d

_{8}⊕d

_{10}⊕d

_{11},

_{3}= d

_{2}⊕d

_{3}⊕d

_{6}⊕d

_{7}⊕d

_{9}⊕d

_{10}⊕d

_{11},

_{4}= d

_{4}⊕d

_{5}⊕d

_{6}⊕d

_{8}⊕d

_{9}⊕d

_{10}⊕d

_{11}.

_{1}= 1, p

_{2}= 1, p

_{3}= 1 and p

_{4}= 0. Thus, the codeword is c = [1 1 1 0 0 1 1 0 1 0 1 1 1 0 1]. Suppose that the received word is c’ = [1 1 1 0 0 1 1 1 1 0 1 1 1 0 1]. The syndrome of c’: s = (s

_{4}, s

_{3}, s

_{2}, s

_{1}) is (1 0 0 1). Then, we can locate the error bit which is at the eighth row in the matrix

**H**(the error position is 8 from the left).

^{T}## 4. The Proposed Scheme

_{1}and I

_{2}) for the same patient. The proposed scheme produces two shadows (S

_{1}and S

_{2}) using the shadows generating algorithm. These two shadows have very little resemblance with the original images. If a malicious entity could, however, acquire one and only one shadow, he/she could not perceive any meaningful information about the patient’s condition from it. For diagnosis purpose, having a shadow is as good as none.

_{1}and S

_{2}. The original image reconstruction algorithm is then used to regenerate the original medical images for diagnosis. Because two shadows can be used to reproduce the two original medical images, we have to put them on two different databases. This is a security measure ensuring that any security breach happened to one server will not compromise the whole system. Without the shadow stored on the other server, the patients’ health information does not leak out after the incidence. In the following sections, the shadow generation and original images reconstruction algorithms are described in detail using both (7,4) Hamming and (15,11) Hamming codes.

#### 4.1. Using (7,4) Hamming Code

_{1}and S

_{2}) from two medical images I

_{1}and I

_{2}. It manipulates the images at pixel level, therefore, one pixel from each original image will be picked sequentially for creating a new pair of pixels of the two shadows.

_{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}] from I

_{1}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}] from I

_{2}are selected as shown in Figure 1, where i

_{1,1}, i

_{1,2}, …, i

_{1,8}and i

_{2,1}, i

_{2,2}, …, i

_{2,8}are the bits in those two pixels. Two corresponding pixels P’

_{1}and P’

_{2}on shadows S

_{1}and S

_{2}are produced as follows:

**Algorithm:**Shadow generation algorithm

**Input:**P

_{1}and P

_{2}

**Output:**P’

_{1}and P’

_{2}

**Step 1.**Assign [d

_{1}d

_{2}d

_{3}d

_{4}] = [i

_{1,1}i

_{1,2}i

_{1,3}i

_{1,4}], and [x

_{1}x

_{2}x

_{3}] = [i

_{2,1}i

_{2,2}i

_{2,3}].

**Step 2**. Use (7, 4) Hamming code to compute c = d ∗ G = [p

_{1}p

_{2}p

_{3}d

_{1}d

_{2}d

_{3}d

_{4}].

**Step 3.**For the codeword c, flip one bit at the position (x

_{3}x

_{2}x

_{1})

_{2}, where x

_{1}is the least significant bit, to output a new codeword c’ = [p’

_{1}p’

_{2}p’

_{3}d’

_{1}d’

_{2}d’

_{3}d’

_{4}].

**Step 4.**Construct two new pixels P’

_{1}and P’

_{2}on shadows as the following.

_{1}= [o

_{1,1}o

_{1,2}o

_{1,3}o

_{1,4}o

_{1,5}o

_{1,6}o

_{1,7}o

_{1,8}]

_{1}d’

_{2}d’

_{3}d’

_{4}i

_{1,5}i

_{1,6}i

_{1,7}i

_{1,8}],

_{2}= [o

_{2,1}o

_{2,2}o

_{2,3}o

_{2,4}o

_{2,5}o

_{2,6}o

_{2,7}o

_{2,8}]

_{1}p’

_{2}p’

_{3}i

_{2,5}i

_{2,6}i

_{2,7}i

_{2,8}].

_{1}and P

_{2}(i.e., in the previous round P

_{1}was selected from I

_{1}, then it will be obtained from I

_{2}in the next round) to make sure that the shadows are very much different from the original images.

**Example 3.**

_{1}= [0 1 1 0 1 1 0 1] and P

_{2}= [1 0 1 0 0 1 0 1]. To generate two shadow pixels P’

_{1}and P’

_{2}, the following steps are executed:

**Step 1**

**.**Determine d and x from P

_{1}and P

_{2}, d = [0 1 1 0] and x = [x

_{1}x

_{2}x

_{3}] = [1 0 1].

**Step 2.**Encode d using (7, 4) Hamming code, we get

**Step 3.**Since x = [1 0 1], flip the 5th bit (from left) of c to get c’ = [1 1 0 0 0 1 0].

**Step 4.**Since d’ = [0 0 1 0] and p’ = [1 1 0], two pixels P’

_{1}= [0 0 1 0 1 1 0 1] and P’

_{2}= [1 1 0 0 0 1 0 1] can be constructed.

_{1}have been changed from 0110 to 0010 in P’

_{1}. The pixel P’

_{2}has also changed since the first three bits have been changed from (101) to (110). As we mentioned earlier, P

_{1}and P

_{2}are selected alternately from the medical images I

_{1}and I

_{2}to ensure that changes are spread evenly between the two shadows images.

_{1}and P’

_{2}are selected from shadows S

_{1}and S

_{2}in turn. The following steps are performed to reconstruct the original images.

**Algorithm:**Original images reconstruction algorithm

**Input:**P’

_{1}and P’

_{2}

**Output:**P

_{1}and P

_{2}

**Step 1.**Assign [d’

_{1}d’

_{2}d’

_{3}d’

_{4}] = [o

_{1,1}o

_{1,2}o

_{1,3}o

_{1,4}] from first four bits of P’

_{1}, and [p’

_{1}p’

_{2}p’

_{3}] = [o

_{2,1}o

_{2,2}o

_{2,3}] from first three bits of P’

_{2}.

**Step 2.**Construct the codeword c’ = [p’

_{1}p’

_{2}p’

_{3}d’

_{1}d’

_{2}d’

_{3}d’

_{4}].

**Step 3.**Compute the syndrome s = [s

_{3}s

_{2}s

_{1}] = c’∗H

^{T}.

**Step 4.**If s is not equal to [0 0 0], go to Step 5; or else, stop the algorithm and return P

_{1}= P’

_{1}and P

_{2}=P’

_{2}.

**Step 5.**Find the position of (s

_{3}s

_{2}s

_{1}) in H

^{T}, i.e., (x’

_{3}x’

_{2}x’

_{1})

_{2}and then obtain the correct codeword [p

_{1}p

_{2}p

_{3}d

_{1}d

_{2}d

_{3}d

_{4}].

**Step 6.**Output the pixels for the original medical images as shown in Figure 2. The pixels P

_{1}and P

_{2}are reconstructed as follows:

_{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}]

_{1}d

_{2}d

_{3}d

_{4}o

_{1,5}o

_{1,6}o

_{1,7}o

_{1,8}],

_{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}]

_{1}x’

_{2}x’

_{3}o

_{2,5}o

_{2,6}o

_{2,7}o

_{2,8}].

**Example 4.**

_{1}= [0 0 1 0 1 1 0 1] and P’

_{2}= [1 1 0 0 0 1 0 1]. Now we apply the original image reconstruction algorithm to get back the two original pixels P

_{1}and P

_{2}as follows.

**Step 1.**Determine d’ = [0 0 1 0] and p’ = [1 1 0].

**Step 2.**The codeword is c’ = [1 1 0 0 0 1 0].

**Step 3.**Compute the syndrome of c’, we have

**Step 4.**Since s = [0 0 1] is not equal to [0 0 0], go to Step 5.

**Step 5.**Flip the bit located at the position (1 0 1) in H

^{T}(the fifth position from the left in c’, i.e., (x’

_{3}x’

_{2}x’

_{1}) = (101), and we have c = [1 1 0 0 1 1 0].

**Step 6.**Obtain the original pixels P

_{1}= [0 1 1 0 1 1 0 1] and P

_{2}= [1 0 1 0 0 1 0 1].

_{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).

_{j}(j = 1 or 2) cannot obtain the original image I

_{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.

_{j}has the pixel [p’

_{1}p’

_{2}p’

_{3}i

_{j,4}i

_{j,5}i

_{j,6}i

_{j,7}i

_{j,8}]:

_{1}p

_{2}p

_{3}d

_{1}d

_{2}d

_{3}d

_{4}], information of (p’

_{1}p’

_{2}p’

_{3}) is completely unrelated to information of (x

_{1}x

_{2}x

_{3}), i.e., the original (i

_{j,1}i

_{j,2}i

_{j,3}). Also, in this case, we do not have (d’

_{1}d’

_{2}d’

_{3}d’

_{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.

_{j}has the pixel [d’

_{1}d’

_{2}d’

_{3}d’

_{4}i

_{j,5}i

_{j,6}i

_{j,7}i

_{j,8}] and the error occurs in (d’

_{1}d’

_{2}d’

_{3}d’

_{4}):

_{1}d’

_{2}d’

_{3}d’

_{4}) and (d

_{1}d

_{2}d

_{3}d

_{4}) differ from one bit. For this case, there is no (p’

_{1}p’

_{2}p’

_{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’

_{1}d’

_{2}d’

_{3}d’

_{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.

_{j}has the pixel [d’

_{1}d’

_{2}d’

_{3}d’

_{4}i

_{j,5}i

_{j,6}i

_{j,7}i

_{j,8}] without the error in (d’

_{1}d’

_{2}d’

_{3}d’

_{4}):

_{1}d’

_{2}d’

_{3}d’

_{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.

_{1}and P

_{2}are selected alternately from the medical images I

_{1}and I

_{2}. There are 50% (∵= 4/8) probability for Case 1. The value of (x

_{1}x

_{2}x

_{3}) causes the error to occur in (d’

_{1}d’

_{2}d’

_{3}d’

_{4}) with 50% probability, and causes the error to occur in (p’

_{1}p’

_{2}p’

_{3}) and no error with 50% (∵= 3/8+1/8) probability. Therefore, all the pixels of the shadow S

_{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. Even though the other 25% of pixels have the same values as those of the original pixels (Case 3), one does not know the position of these pixels. From the above description, we cannot obtain the original image I

_{j}from one S

_{j}. The security condition is achieved.

_{1}and S

_{2}. From [p’

_{1}p’

_{2}p’

_{3}d’

_{1}d’

_{2}d’

_{3}d’

_{4}], the correct codeword [p

_{1}p

_{2}p

_{3}d

_{1}d

_{2}d

_{3}d

_{4}] is recovered, and thus the value of (x

_{1}x

_{2}x

_{3}) is obtained. Finally, the original pixels are recovered. ☐

#### 4.2. Using (15,11) Hamming Code

**Algorithm:**Shadows generation algorithm

**Input:**P

_{1}and P

_{2}

**Output:**P’

_{1}and P’

_{2}

**Step 1.**Assign [d

_{1}d

_{2}d

_{3}d

_{4}d

_{5}d

_{6}d

_{7}d

_{8}d

_{9}d

_{10}d

_{11}] = [i

_{1,1}i

_{1,2}i

_{1,3}i

_{1,4}i

_{1,5}i

_{1,6}i

_{1,7}i

_{1,8}i

_{2,1}i

_{2,2}i

_{2,3}], and [x

_{1}x

_{2}x

_{3}x

_{4}] = [i

_{2,4}i

_{2,5}i

_{2,6}i

_{2,7}].

**Step 2.**Use (15,11) Hamming code to compute c = d∗G = [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}].

**Step 3.**For the codeword c, flip the bit at the position (x

_{4}x

_{3}x

_{2}x

_{1})

_{2}to output a new codeword c’ = [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}].

**Step 4.**Construct two new pixels P’

_{1}and P’

_{2}on shadows as the following.

_{1}= [o

_{1,1}o

_{1,2}o

_{1,3}o

_{1,4}o

_{1,5}o

_{1,6}o

_{1,7}o

_{1,8}]

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}],

_{2}= [o

_{2,1}o

_{2,2}o

_{2,3}o

_{2,4}o

_{2,5}o

_{2,6}o

_{2,7}o

_{2,8}]

_{9}d’

_{10}d’

_{11}p’

_{1}p’

_{2}p’

_{3}p’

_{4}i

_{2,8}].

**Note:**Similar to the algorithms using (7,4) Hamming code, the input pixels are taken alternatively from two original images. P

_{1}is first taken from I

_{1}, then in the next round P

_{1}is taken from I

_{2}; the same goes for P

_{2}. This ensures that the outputs are mixed up nicely to produce the shadows.

**Algorithm:**Original image reconstruction algorithm

**Input:**P’

_{1}and P’

_{2}

**Output:**P

_{1}and P

_{2}

**Step 1.**Assign [d’

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}d’

_{9}d’

_{10}d’

_{11}] = [o

_{1,1}o

_{1,2}o

_{1,3}o

_{1,4}o

_{1,5}o

_{1,6}o

_{1,7}o

_{1,8}o

_{2,1}o

_{2,2}o

_{2,3}] from all eight bits of P’

_{1}and the first 3 bits of P’

_{2}, and [p’

_{1}p’

_{2}p’

_{3}p’

_{4}] = [o

_{2,4}o

_{2,5}o

_{2,6}o

_{2,7}].

**Step 2.**Construct the codeword c’ = [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}].

**Step 3.**Compute the syndrome s = [s

_{4}s

_{3}s

_{2}s

_{1}] = c’ ∗ H

^{T}.

**Step 4.**If s is not equal to [0 0 0 0], go to Step 5; or else, stop the algorithm and return P

_{1}=P’

_{1}and P

_{2}=P’

_{2}.

**Step 5.**Find the position of (s

_{4}s

_{3}s

_{2}s

_{1}) in H

^{T}, i.e., (x’

_{4}x’

_{3}x’

_{2}x’

_{1})

_{2}and then 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}].

**Step 6.**Output the pixels for the original medical images. Pixels P

_{1}and P

_{2}are reconstructed as follows:

_{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}]

_{1}d

_{2}d

_{3}d

_{4}d

_{5}d

_{6}d

_{7}d

_{8}],

_{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}]

_{9}d

_{10}d

_{11}x’

_{1}x’

_{2}x’

_{3}x’

_{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

_{j}(j= 1 or 2) cannot obtain the original image I

_{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.

_{j}has the pixel [d’

_{9}d’

_{10}d’

_{11}p’

_{1}p’

_{2}p’

_{3}p’

_{4}i

_{j,8}]:

_{1}x

_{2}x

_{3}x

_{4}) cannot be obtained. Thus, the pixel value is different from the original one.

_{j}has the pixel [d’

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}] with one error:

_{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’

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}). So, the pixel values are different from the original one.

_{j}has the pixel [d’

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}] without error:

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}) and (d

_{1}d

_{2}d

_{3}d

_{4}d

_{5}d

_{6}d

_{7}d

_{8}) are the same, and thus have the same pixel values.

_{1}and P

_{2}are selected alternately from medical images I

_{1}and I

_{2}. There is a 50% probability for Case 1. The value of (x

_{1}x

_{2}x

_{3}x

_{4}) causes the error to occur in (d’

_{1}d’

_{2}d’

_{3}d’

_{4}d’

_{5}d’

_{6}d’

_{7}d’

_{8}) with a 50% (∵ = 8/16) probability, and meanwhile, the error occurs in(d’

_{9}d’

_{10}d’

_{11}p’

_{1}p’

_{2}p’

_{3}p’

_{4}) and no error has 50% (∵7/16 + 1/16) probability. All the pixels of the shadow S

_{j}(j = 1 or 2) have 50%, 25% and 25% probabilities for Case 1, Case 2 and Case 3, respectively. Finally, there are 75% of pixels different from the original pixels. Even though the other 25% of pixels have the same values as those of the original pixels (Case 3), one does not know the position of these pixels. From the above description, we cannot obtain the original image I

_{j}from one S

_{j}. The security condition is achieved.

_{1}and S

_{2}. From [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}], 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}] is recovered, and thus the value of (x

_{1}x

_{2}x

_{3}x

_{4}) is obtained. Finally, the original pixels are recovered. ☐

## 5. Experiments and Discussions

#### 5.1. Experimental Results

#### 5.2. Comparisons

#### 5.3. Discussions

_{min}= 2t + 1, where m (m ≥ 3) is a positive integer and t is the error correcting capability. Actually, BCH code is a generalization of the Hamming code. For t = 1, a BCH code is the Hamming code with n = 2m − 1, (n − k) = m, and d

_{min}= 3. Our approach deals with two pixels P

_{1}and P

_{2}simultaneously. There are a total of 16 bits in the pair (P

_{1}and P

_{2}). Thus, BCH codes with m ≥ 5 having block length n ≥ 31 larger than 16 cannot be used in our two-pixel approach. BCH code with m = 3 is the (7,4) Hamming code. For m=4, there are three BCH codes with t = 1, 2 and 3, respectively. Note: for t = 1, it is the (15,11) Hamming code. On the other hand, for t = 2 and 3, the codes are (15,7) BCH code and (15,5) BCH code.

_{1}and S

_{2}.

## 6. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## References

- Chen, J.; Zhu, Z.; Fu, C.; Yu, H.; Zhang, L. A fast chaos-based image encryption scheme with a dynamic state variables selection mechanism. Commun. Nonlinear Sci. Numer. Simul.
**2015**, 20, 846–860. [Google Scholar] [CrossRef] - Dong, C. Asymmetric color image encryption scheme using discrete-time map and hash value. Optik. Int. J. Light Electron. Opt.
**2015**, 126, 2571–2575. [Google Scholar] [CrossRef] - Liu, H.; Kadir, A.; Gong, P. A fast color image encryption scheme using one-time S-Boxes based on complex chaotic system and random noise. Opt. Commun.
**2015**, 338, 340–347. [Google Scholar] [CrossRef] - Mannai, O.; Bechikh, R.; Hermassi, H.; Rhouma, R.; Belghith, S. A new image encryption scheme based on a simple first-order time-delay system with appropriate nonlinearity. Nonlinear Dyn.
**2015**, 82, 107–117. [Google Scholar] [CrossRef] - Bullock, A.; Dimond, R.; Webb, K.; Lovatt, J.; Hardyman, W.; Stacey, M. How a mobile app supports the learning and practice of newly qualified doctors in the UK: An intervention study. BMC Med. Educ.
**2015**, 15, 71. [Google Scholar] [CrossRef] [Green Version] - Zhang, K.; Yang, K.; Liang, X.; Su, Z.; Shen, X.; Luo, H.H. Security and privacy for mobile healthcare networks: From a quality of protection perspective. IEEE Wirel. Commun.
**2015**, 22, 104–112. [Google Scholar] [CrossRef] - Zhang, L.; Jung, T.; Liu, C.; Ding, X.; Li, X.Y.; Liu, Y. Pop: Privacy-preserving outsourced photo sharing and searching for mobile devices. In Proceedings of the International conference on distributed computing systems, Columbus, OH, USA, 29 June–2 July 2015; pp. 308–317. [Google Scholar]
- Shao, J.; Lu, R.; Lin, X. Fine-grained data sharing in cloud computing for mobile devices. In Proceedings of the 2015 IEEE conference on computer communications (INFOCOM), Kowloon, Hong Kong, China, 26 April–1 May 2015; pp. 2677–2685. [Google Scholar]
- Ibtihal, M.; Hassan, N. Homomorphic encryption as a service for outsourced images in mobile cloud computing environment. In Cryptography: Breakthroughs in Research and Practice; IGI Global: Hershey, PA, USA, 2020; pp. 316–330. [Google Scholar]
- Shankar, T.N.; Sahoo, G.; Niranjan, S. Image encryption for mobile devices. In Proceedings of the International Conference in Communication Control and Computing Technologies, Ramanathapuram, India, 7–9 October 2010; pp. 612–616. [Google Scholar]
- La Rosa, M.; Rabinovich, M.I.; Huerta, R.; Abarbanelac, H.D.I.; Fortuna, L. Slow regularization through chaotic oscillation transfer in an unidirectional chain of Hindmarsh–Rose models. Phys. Lett. A
**2000**, 266, 88–93. [Google Scholar] [CrossRef] - Wang, F.; Ding, J.; Dai, Z.; Peng, Y. An application of mobile phone encryption based on Fibonacci structure of chaos. In Proceedings of the 2010 Second World Congress on Software Engineering, Wuhan, China, 19–20 December 2010; Volume 2, pp. 97–100. [Google Scholar]
- Kim, C. Data hiding using improving hamming code. J. Inst. Electron. Inf. Eng.
**2013**, 50, 180–186. [Google Scholar] [CrossRef] - Kim, C.; Yang, C.N. Data hiding based on overlapped pixels using hamming code. Multimed. Tools Appl.
**2014**, 75, 1–13. [Google Scholar] - Wang, J.T.; Chang, Y.C.; Yu, S.S.; Yu, C.Y. Hamming Code Based Watermarking Scheme for 3D Model Verification. In Proceedings of theInternational Symposium on Computer, Consumer and Control, Taichung, Taiwan, China, 10–12 June 2014; pp. 1095–1098. [Google Scholar]
- Blakley, G.R. Safeguarding cryptographic keys. In Proceedings of the National Computer Conference, New York, NY, USA, 4–7 June 1979; Volume 48, pp. 313–317. [Google Scholar]
- Shamir, A. How to share a secret. Commun. ACM
**1979**, 22, 612–613. [Google Scholar] [CrossRef] - Thien, C.C.; Lin, J.C. Secret image sharing. Comput. Graph.
**2002**, 26, 765–770. [Google Scholar] [CrossRef] - Wang, R.Z.; Su, C.H. Secret image sharing with smaller shadow images. Pattern Recognit. Lett.
**2006**, 27, 551–555. [Google Scholar] [CrossRef] - Wang, R.Z.; Shyu, S.J. Scalable secret image sharing. Signal Process. Image Commun.
**2007**, 22, 363–373. [Google Scholar] [CrossRef] - Chang, C.C.; Lin, C.C.; Lin, C.H.; Chen, Y.H. A novel secret image sharing scheme in color images using small shadow images. Inf. Sci.
**2008**, 178, 2433–2447. [Google Scholar] [CrossRef] - Chang, C.C.; Wu, M.N. An algorithm for color image compression base on common bit map block truncation coding. In Proceedings of the 6th Joint Conference on Information Science, Research Triangle Park, NC, USA, 8–13 March 2002; pp. 964–967. [Google Scholar]
- Tsai, D.S.; Horng, G.; Chen, T.H.; Huang, Y.T. A novel secret image sharing scheme for true-color images with size constraint. Inf. Sci.
**2009**, 179, 3247–3254. [Google Scholar] [CrossRef] - Chang, C.C.; Lin, C.Y.; Tseng, C.S. Secret image hiding and sharing based on the (t, n)-threshold. Fundam. Inform.
**2007**, 76, 399–411. [Google Scholar] - Chang, C.C.; Chen, Y.H.; Wang, H.C. Meaningful secret sharing technique with authentication and remedy abilities. Inf. Sci.
**2011**, 181, 3073–3084. [Google Scholar] [CrossRef] - Eslami, Z.; Razzaghi, S.H.; Ahmadabadi, J.Z. Secret image sharing based on cellular automata and steganography. Pattern Recognit.
**2010**, 43, 397–404. [Google Scholar] [CrossRef] - Eslami, Z.; Ahmadabadi, J.Z. Secret image sharing with authentication-chaining and dynamic embedding. J. Syst. Softw.
**2011**, 84, 803–809. [Google Scholar] [CrossRef] - Lin, P.Y.; Chan, C.S. Invertible secret image sharing with steganography. Pattern Recognit. Lett.
**2010**, 31, 1887–1893. [Google Scholar] [CrossRef] - Wu, C.C.; Kao, S.J.; Hwang, M.S. A high quality image sharing with steganography and adaptive authentication scheme. J. Syst. Softw.
**2011**, 84, 2196–2207. [Google Scholar] [CrossRef] - Wu, X.; Ou, D.; Ling, Q.; Sun, W. A user-friendly secret image sharing scheme with reversible steganography based on cellular automata. J. Syst. Softw.
**2012**, 85, 1852–1863. [Google Scholar] [CrossRef] - Liu, Y.; Chang, C.C. A Turtle Shell-Based Visual Secret Sharing Scheme with Reversibility and Authentication. Multimed. Tools Appl.
**2018**, 77, 25295–25310. [Google Scholar] [CrossRef] - Anbarasi, L.J.; Mala, A. EPR hidden medical image secret sharing using DNA cryptography. Int. J. Eng. Technol.
**2014**, 6, 1346–1356. [Google Scholar] - Fatma, E.; Hikal, N.A.; Abou-Chadi, F.E.Z. Secret medical image sharing and EPR data embedding scheme over cloud computing environment. Int. J. Comput. Appl.
**2013**, 69, 19–26. [Google Scholar] - Tso, H.K.; Lo, T.M.; Chen, W.K. Friendly medical image sharing scheme. J. Inf. Hiding Multimed. Signal Process.
**2014**, 5, 367–378. [Google Scholar] - Ulutas, M.; Ulutas, G.; Nabiyev, V.V. Medical image security and EPR hiding using Shamir’s secret sharing scheme. J. Syst. Softw.
**2011**, 84, 341–353. [Google Scholar] [CrossRef] - Morelos-Zaragoza, R.H. The Art of Error Correcting Coding, 2nd ed.; John Wiley & Sons: Hoboken, NJ, USA, 2006. [Google Scholar]
- Yang, C.N.; Yu, K.H.; Lukac, R. User-friendly image sharing using polynomials with different primes. Int. J. Imaging Syst. Technol.
**2007**, 17, 40–47. [Google Scholar] [CrossRef] - Thien, C.C.; Lin, J.C. An image-sharing method with user-friendly shadow images. IEEE Trans. Circuits Syst.
**2003**, 13, 1161–1169. [Google Scholar] [CrossRef] - Islam, M.S.; Kim, C.H.; Kim, J.M. Computationally efficient implementation of a hamming code decoder using graphics processing unit. J. Commun. Netw.
**2014**, 17, 198–202. [Google Scholar] [CrossRef] [Green Version] - Vo, H.P. User-friendly sharing system using polynomials with different primes in two images. Int. J. Comput. Appl.
**2014**, 86, 40–45. [Google Scholar]

Comparison of Experiment Results | |||||||
---|---|---|---|---|---|---|---|

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(1-1) | (1-2) | (1-3) | (1-4) | (1-5) | (1-6) | (1-7) | (1-8) |

Original Medical Images | |||||||

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(1-9) PSNR = 44.14 | (1-10) PSNR = 41.90 | (1-11) PSNR = 40.09 | (1-12) PSNR = 41.41 | (1-13) PSNR = 42.24 | (1-14) PSNR = 40.35 | (1-15) PSNR = 40.79 | (1-16) PSNR = 40.84 |

Shadow Images Produced by Using LSBs | |||||||

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(1-17) PSNR = 26.35 | (1-18) PSNR = 25.49 | (1-19) PSNR = 23.57 | (1-20) PSNR = 24.19 | (1-21) PSNR = 24.79 | (1-22) PSNR = 24.23 | (1-23) PSNR = 23.26 | (1-24) PSNR = 24.42 |

Shadow Images Produced by Using Middle Bits | |||||||

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(1-25) PSNR = 18.97 | (1-26) PSNR = 19.95 | (1-27) PSNR = 14.10 | (1-28) PSNR = 13.84 | (1-29) PSNR = 16.66 | (1-30) PSNR = 13.23 | (1-31) PSNR = 13.38 | (1-32) PSNR = 14.75 |

Shadow Images Produced by Using MSBs |

Comparison of Experiment Results | |||||||
---|---|---|---|---|---|---|---|

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(2-1) | (2-2) | (2-3) | (2-4) | (2-5) | (2-6) | (2-7) | (2-8) |

Original Medical Images | |||||||

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(2-9) PSNR = 28.96 | (2-10) PSNR = 27.37 | (2-11) PSNR = 26.90 | (2-12) PSNR = 23.66 | (2-13) PSNR = 25.20 | (2-14) PSNR = 21.09 | (2-15) PSNR = 21.82 | (2-16) PSNR = 21.05 |

Shadow Images Produced by Using LSBs | |||||||

Pair 1 | Pair 2 | Pair 3 | Pair 4 | ||||

(2-17) PSNR = 26.84 | (2-18) PSNR = 27.55 | (2-19) PSNR = 22.14 | (2-20) PSNR = 21.52 | (2-21) PSNR = 21.99 | (2-22) PSNR = 17.63 | (2-23) PSNR = 19.14 | (2-24) PSNR = 19.32 |

Shadow images produced by using MSBs |

**Table 3.**Comparisons of specific features between original images and shadow images using the proposed scheme.

Original Medical Images | Shadow Images Produced by Using (7,4) Hamming Code (MSBs) | ||
---|---|---|---|

Pair 1 | Pair 2 | ||

Pair 3 | Pair 4 | ||

Shadow images produced by using (15,11) Hamming code (LSBs) | Shadow images produced by using (15,11) Hamming code (MSBs) |

Methods | Time (s) | |||
---|---|---|---|---|

(MSBSs) | Creating Shadow (s) | Reconstructing Original Images (s) | Execution Time (s) | |

(7,4) Hamming code | Pair 1 | 0.6060 | 0.6104 | 1.2164 |

Pair 2 | 0.6653 | 0.6711 | 1.3364 | |

Pair 3 | 0.6507 | 0.6576 | 1.3083 | |

Pair 4 | 0.6344 | 0.6908 | 1.3252 | |

(15,11) Hamming code | Pair 1 | 0.7054 | 0.8147 | 1.5201 |

Pair 2 | 0.7534 | 0.8403 | 1.5937 | |

Pair 3 | 0.6996 | 0.8011 | 1.5007 | |

Pair 4 | 0.7704 | 0.8715 | 1.6419 | |

Average | 0.6857 | 0.7447 | 1.4303 |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Li, L.; Chang, C.-C.; Bai, J.; Le, H.-D.; Chen, C.-C.; Meen, T.-H.
Hamming Code Strategy for Medical Image Sharing. *Appl. Syst. Innov.* **2020**, *3*, 8.
https://doi.org/10.3390/asi3010008

**AMA Style**

Li L, Chang C-C, Bai J, Le H-D, Chen C-C, Meen T-H.
Hamming Code Strategy for Medical Image Sharing. *Applied System Innovation*. 2020; 3(1):8.
https://doi.org/10.3390/asi3010008

**Chicago/Turabian Style**

Li, Li, Ching-Chun Chang, Junlan Bai, Hai-Duong Le, Chi-Cheng Chen, and Teen-Hang Meen.
2020. "Hamming Code Strategy for Medical Image Sharing" *Applied System Innovation* 3, no. 1: 8.
https://doi.org/10.3390/asi3010008