1. Introduction
According to the advanced development of information technologies, the internet has become an indispensable part of data delivery in our daily life. The creation of content such as digital images is getting easier than before. It can be produced by a digital camera, scanner, computer software, etc. The image might be stolen, have tampered content, or even be misappropriated by an unexpected user. Thus, how to organize, store, and deliver the images becomes an important issue because the internet is not a secure environment [
1].
Digital image content integrity has been an important research topic of digital image management in recent years. Digital images are easy to copy and transmit anywhere over public computer networks, and can be spread across the world very fast. Also, it could easily be tampered with and transformed by the unexpected user. Thus, the integrity of a digital image is determined by checking whether an image has been tampered with or not. Generally speaking, the integrity is not only checking the difference from the original image but also to point out the area of the tampered part, in the case of an image that has been tampered with. For example, the correctness of license plate information on a vehicle violation photo is quite important. That means the vehicle violation image cannot be tampered with [
2,
3,
4].
Normally, the tampered area detecting can be done by comparing the difference between original image and tampered image. This is not an efficient way to authenticate the integrity of an image. Many researchers use an information hiding technique to embed the features of a digital image into the image to achieve the goal of image integrity protection. When image integrity checking is required, the verification information can be extracted from the image, then applied to their image authentication procedure to check the tampered area on the image.
Bitcoin has become a famous cryptocurrency in recent years, the developers combined open source software and cryptography, and it operates on a P2P network and decentralized databases. The system allows the nodes of the entire P2P network to be used to reach a network agreement according to the seed file, ensuring that the currency is secure and trustworthy in its issuance, management, and circulation [
5,
6,
7]. Actually, the blockchain technique can be applied to many applications in the real world such as IoT, FinTech, virtual currency, etc.
We try to design an image management system which is composed by Merkle tree technology in the blockchain, Inter-Planetary File System (IPFS) decentralized storage system, and image verification scheme [
8]. IPFS is a P2P distributed storage system that attempts to connect all computing devices to the same file system for large amounts of data storage [
8]. However, IPFS did not provide the function of image integrity verification. We were inspired by the blockchain technique and IPFS to create a blockchain based image integrity verification scheme.
In this paper, Merkle tree technology is adopted to generate the image verification information, and IPFS is used to manage the verification data and to form the proposed image verification scheme. In order to solve the drawback of centralized image management, the proposed method utilizes the IPFS protocol to handle image authentication data management with decentralized properties. Here, the proposed method not only provides the image authentication ability but can also restore the tampered area. According to our design, it is not necessary to have a trusted third party to manage the image verification data. The verification method is performed by each node in the blockchain network.
The remaining sections of this paper are organized as follows.
Section 2 shows some background knowledge related to the blockchain, Merkle tree, and image authentication.
Section 3 shows the detail of the proposed image authentication steps. The simulation results are illustrated in
Section 4. Finally, we make some conclusions in
Section 5.
4. Simulation Results
In order to evaluate the performance of the proposed method, we implemented it in Ubuntu 18.04.02 OS on a quad-core 3.4 GHz CPU with 4GB RAM. Six commonly used images were used in our simulation, namely, Lena, Baboon, Jet, Boat, Pepper, and Sailboat. All of the images were 8-bit grayscale images, and the size of each image was
pixels, as shown in
Figure 13.
The blockchain was implemented using python 3.6.8, the program refers to the article on the blockchain structure [
5,
7,
11,
12]. As shown in
Figure 14, the genesis block (also called the first block) was generated in the blockchain. The value of the previous hash has sixty-four ‘0’. The image block size is
(e.g.,
) pixels in the Merkle tree generation method (Refer to
Section 3.1), and RSA encryption is applied to play the encryption mechanism in our method.
In our simulation, the image can be divided into 2048 block images. The RSA key pair was generated by applying python Cryptographic module pycrypto 2.6.1. After that, encrypted files were uploaded to IPFS.
Figure 15 shows a part of the fingerprint after upload
to IPFS. Each fingerprint of
is added to the transaction and the Merkle Root is stored into a block in the blockchain, the result is shown as
Figure 16.
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 (
).
Figure 18 shows the result of the detected tamper area on the tampered Lena image.
Figure 18a is the result when
, while
Figure 18b is the result when
.
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.
The size of slicing block setting is highly related to fineness of tampered area. When
, the detected area is very rough, and covers a lot of areas that have not been changed. When
, 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
monochrome image
I and its noisy approximation
K, mean squared error
is defined as:
The PSNR (in dB) is defined as:
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,
Table 1 and
Table 2 shown the experiment results of the different testing image.
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.
The false positive rate of the tampering area evaluations is not suitable for the proposed method—because of the features of IPFS, the same image file has only one corresponding fingerprint, even when adjusting the brightness or contrast of the image.
Our proposed method can not only work on grayscale images but also on any type and any size of digital image. See
Figure 22a, where the testing image size is 768 × 512 pixels 24-bit color images, and the tampered image is shown in
Figure 22b.
Figure 22c shows the result of using our proposed method on an RGB image.
5. Conclusions
The slice block size N depends on each case, the smaller the size, the more accurate the detection, but the larger the generating of the Merkle tree will be, and vice versa. In this paper, we integrate Merkle tree technology, IPFS decentralized storage system, and an image verification process to achieve the goal of image verification. The proposed method shows the ability to perform integrity verification and recovery of images. From the simulation results, we have achieved a verification and restoration process of the image tampering area. We suggest that N = 32 and = 5 is suitable in our proposed method. In terms of file types, we only mention the digital image in this paper. For future works, this may not only be applied to the digital image file but also expanded to video or any other multimedia (e.g., a decentralized document verification system). Through this system, governments or organizations can protect their documents, avoid tampering or falsifying messages, and ensure the credibility of documents. In addition to blockchain framework research, it is also worth studying for blockchain smart contracts.
References