# An Image Authentication Scheme Using Merkle Tree Mechanisms
## 3 Proposed Method
### Image Verification
Figure 15 shows a part of the fingerprint after upload \(B_{i}^{{}^{\prime}}\) to IPFS. Each fingerprint of \(B_{i}^{{}^{\prime}}\) is added to the transaction and the Merkle Root is stored into a block in the blockchain, the result is shown as Figure 16.

Figure 14: Running program of the blockchain. Figure 13: Test images. For testing the effectiveness of tamper area detection in our method, we tamper the test image (e.g., add a flower into Lena image), shown in Figure 17. The testing uses different slicing block sizes (\(N=\{128,64,32,16\}\)). Figure 18 shows the result of the detected tamper area on the tampered Lena image. Figure 18a is the result when \(N=32\), while Figure 18b is the result when \(N=16\). Figure 19 shows the detection accuracy results in different slicing block size. As we see, the accuracy is improved when the slicing size is smaller. Figure 16: Stored transaction information to a block. Figure 17: Tampered images. (**a**) Lena, (**b**) Baboon, (**c**) Jet, (**d**) Boat, (**e**) Pepper, (**f**), Sailboat. Figure 9:0 The result of detected tamper area with different slicing size: (**a**) Lena, (**b**) Baboon, (**c**) Jet, (**d**) Boat, (**e**) Pepper, (**f**), Sailboat. Figure 9:1 The result of tampered region detection on tampered Lena image (**a**) \(N=32\) (**b**) \(N=16\). The size of slicing block setting is highly related to fineness of tampered area. When \(N=128\), the detected area is very rough, and covers a lot of areas that have not been changed. When \(N<128\), the detected area is getting more excellent, meaning when the setting of \(N\) is smaller, we will get a better detection result. On the other hand, the size of Merkle tree is also highly correlated with the image block, which means a small \(N\) will lead to a large Merkle tree compared to large \(N\). Figure 20 shows that when the amount of a sliced block reaches the maximum node of bottom layers of Merkle tree, the size of Merkle tree will grow in multiples. In this experiment, an \(N\) value of 32 is the most appropriate. Visual quality is an important factor for evaluating the performance of the image restoration method. We adopt the PSNR (peak signal-to-noise ratio) value as the visual quality measurement in our simulation. PSNR approximates human perception of reconstruction quality, as shown in Equations (1) and (2). Given a noise-free \(m\times n\) monochrome image \(I\) and its noisy approximation \(K\), mean squared error \(MSE\) is defined as:

Figure 9:2

The PSNR (in dB) is defined as:

Figure 9:3

Due to the characteristics of the hashing function, as long as there is a slight change or even a bit, the hash values will be completely different. In order to make this method more robust, we extract the first few bits of the Most Significant Bit (MSB) of the image. In this experiment, we take two approaching parameters to our proposed method, MSB and block slice size \(N\), and made several different adjustments. The MSB values are 3, 4, 5, and 6 bits; and block slice sizes are 128, 64, 32, and 16 pixels, making up to 16 different measurements, Tables 1 and 2 shown the experiment results of the different testing image. Figure 9:4 The size of Merkle tree in different amounts of sliced block. Refer to Figure 21, the MSB setting is highly related to visual quality. The PSNR value is not much different when the MSB value is 3 bits and 4 bits. However, when the MSB value is 5 bits or more, the PSNR value is significant improved. That means the higher the MSB value setting, the better the PSNR value, and more complete the recovery. However, the MSB values will affect the accuracy of detecting the tampered area of the image. If the MSB value is set too high, its recognition will not be robust. In this experiment, an MSB value of 5 bits is the most appropriate.