You are on page 1of 5

26th International Computer Conference, Computer Society of Iran, Tehran, Iran

A New Fragile Watermarking based on


Distributed Hamming Code
Faeze Rasouli Mohammad Taheri
2021 26th International Computer Conference, Computer Society of Iran (CSICC) | 978-1-6654-1241-4/20/$31.00 ©2021 IEEE | DOI: 10.1109/CSICC52343.2021.9420541

M.S. candidate of Computer Sci. & Eng. & Inf. Tech. Dept. Assistant Prof. of Computer Sci. & Eng. & Inf. Tech. Dept.
Shiraz University Shiraz University
Shiraz, Iran Shiraz, Iran
f.rasouli@shirazu.ac.ir motaheri@shirazu.ac.ir

Abstract— In this paper, a novel fragile watermarking scheme signal, which is done for purposes such as copyright
is proposed for both tamper detection and tampered image protection, integrity and authentication.
recovery based on Hamming code. To serve this purpose, the In general, watermarking can be classified into three
authentication code (check bits) is computed using Hamming code main categories: robust watermarking, semi-fragile
from data bits. In this work, data bits were selected from the five watermarking and fragile watermarking. Robust
Most Significant Bits (5_MSB) of the pixel values and
Watermarking [1-2] schemes are designed to resist any
authentication code is embedded into the three Least Significant
Bits (3LSBs) to preserve image quality. Hamming (7,4) has been editing operations and sustain under all kinds of attacks
extended, in this paper, to (8,5) and is used for embedding, error that attempt to destroy the watermark in the image. Semi-
detection and correction. Each instance of coding is applied on fragile watermarking [3] schemes are designed with the
eight pixels (one bit per pixel) located in sufficient far parts of the ability to resist against non-intentional manipulations such
image. Hence, for tampers smaller than a threshold, the recovery as compression, slight noising, filtering, and other basic
can be done perfectly. According to the experimental results, the operations of image processing. Finally, fragile
proposed method achieves better performance in terms of watermarking [5-12] schemes are designed with the ability
recovering the tampered areas, compared to state-of-the-art. to detect any modifications or every possible change in a
watermarked image. Semi-fragile Watermarking and
Keywords— Authentication code, Fragile watermarking,
fragile watermarking approaches are frequently applied to
Hamming code, Tamper detection and recovery
tamper detection and tampered image recovery.
I. INTRODUCTION In the present study, a novel fragile watermarking
scheme for tamper detection and recovery is proposed. For
Hiding information in multimedia information, such as
this purpose, the image is divided into sixteen parts. We
audio, video and text, is a new topic that has been proposed
consider eight parts to be white parts and eight parts to be
and developed rapidly in recent years. Information hiding
black parts of these sixteen parts. To generate
generally includes the three disciplines of cryptography,
authentication code based on Hamming code, we need four
watermarking, and steganography.
bits which are selected from four independent parts in the
Encrypting the content of a message is called
image. It should be noted that the chosen bits must be
cryptography. In some cases, it may seem that
among the four most significant bits (4MSB) of each
cryptography can provide an appropriate security level for
different pixel. The authentication code is embedded in the
multimedia information, but this approach practically
three least significant bits (3LSB) of three different pixels
triggers the attackers.
that are located in the other three independent parts.
In steganography, the existence of an encrypted
Another additional bit is used to generate the
message is denied, and in fact, the secret message is hidden
authentication code. This bit is selected from the part that
by hosting a secondary environment (single media or
did not participate in the embedding authentication code.
multimedia). The advantage of steganography and
According to this category, it is required to put all four
watermarking is that since the (secret) message is hidden
independent parts in one category and generate the
from public view, the efforts and motivations to decrypt it
authentication code. Since there are sixteen independent
are reduced accordingly. The main difference between
parts in the image, the check bit generation process must
steganography and watermarking is in the signal value. In
be done for every four parts in a category. In the temper
watermarking, the host signal is important, while in
detection and temper recovery phase, the Syndrome vector
steganography, the hidden message is important.
is generated based on the decoding of Hamming (7, 4). If
The evolution and the advancement of digital
the Syndrome vector is opposite [000], it indicates
technology, and at the same time developing the use of
tampering. In this way, the tampered area is localized. The
new communication paths, such as the Internet, has
Syndrome vector that is opposite to [000] represent the
enabled easier communication to transmit digital data with
damaged bits. By toggling these bits, the image is
minimal error. As a result, multimedia data can be easily
recovered.
published, edited, and copied. Therefore, free access and
In what follows, Hamming code technique is briefly
exchange of information increase the possibility of data
described in section II. Section III explains the related
misuse as well. Several watermarking techniques have
work. Section IV describes the proposed novel fragile
been proposed to increase the security of multimedia
watermark scheme, including watermark embedding, the
information such as a digital image. Watermarking
tampered area's detection, and recovery of the tampered
technology means embedding a watermark in the host

978-1-6654-1241-4/21/$31.00 ©2021 IEEE

Authorized licensed use limited to: East Carolina University. Downloaded on June 16,2021 at 09:36:09 UTC from IEEE Xplore. Restrictions apply.
area. Experimental results are presented in Section V. tamper detecting after Level 2 and Level 3 inspections is
Finally, the paper is concluded in Section VI. close to 99.6% and 100%.
A dual watermark scheme for image tamper detection
II. PRELIMINARY and recovery is presented by Lee and Shinfeng [6]. Their
Hamming code is a liner code capable of detecting up proposed method improved Lin`s method by solving two
to two simultaneous bit errors and correcting single-bit main drawbacks. In their proposed method, a second
errors. It was developed by R.W. Hamming for error chance is provided to recover the destroyed block in such
detection and correction [4]. Hamming (7,4) encodes four a way that for each non-overlapping block, two copies of
bits of data into seven bits by adding three parity bits. the watermark are maintained. The size of each block is 2
Suppose D1, D2, D3, D4, are data bits, parity bits are × 2 pixels. The watermark length is 12 bits, and the
calculated by XOR operation of its associated data bits. average intensity of each block is used to generate
The relationship between a check bit and its related data recovery bits. Finally, the watermark is embedded in the
bits is shown in (1) where ⊕ is an exclusive or, (XOR) three least significant bits per pixel.
operation. In 2020, Sarkar et al. proposed two schemas for image
= ⊕ ⊕ tamper detection and restoration [7], one of which works
= ⊕ ⊕ (1) in the spatial domain and implements a quadruple
= ⊕ ⊕ watermarking approach. In their proposed method, four
The arrangement of four data bits and three check bits is chance is provided to recover the destroyed block, the
shown in Fig. 1. It is demonstrated that all the bit positions watermark is generated form four blocks and is embedded
that are a power of 2 are marked as parity bits, in other identically blocks using the mapping algorithm.
Subsequently, all other bit positions are marked as data The size of each block is 3 × 3 pixels. The watermark
bits. The Hamming decoder is responsible for generating length is 18 bits, and the average intensity of each block is
the Syndrome vector S= [ ] from received vector = used to generate recovery bits. Finally, the watermark is
[ … ] that tells which parity-check equations are not embedded in the two least significant bits per pixel.
satisfied. The Syndrome vector is calculated using the In 2011, Chan proposed an image authentication
following statement. method using the Hamming code technique [8]. This
= ⊕ ⊕ ⊕ method improved Chan and Chang's method [9] by
= ⊕ ⊕ ⊕ (2) determining the most-significant bit of each pixel
= ⊕ ⊕ ⊕ according to its check bits. Chang's method's [9] drawback
If the Syndrome vector is equal to [0 0 0], it means that was that the most significant bit per pixel was predicted
no errors have occurred. If the Syndrome vector is not based on neighboring pixels since the MSB plays an
equal to [0 0 0], it indicates which bit of the received vector important role in the intensity value of one pixel, so this
is in error. To better understand, suppose that the method increases the error rate by incorrectly predicting.
Syndrome vector is equal to [1 0 1], which indicates that Chan reduced the effect of this error by rearranging each
the 5 bit of the received vector is in error. Now for pixel's bits and then generating the check bits.
correcting, the 5 bits of the received vector should be IV. PROPOSED METHOD
toggle.
In this section, a new method is presented that takes the
III. RELATED WORK Hamming code in to consideration for tamper detection
Various researchers for fragile watermarking have and tamper recovery. This approach consists of three
proposed several algorithms. The first study to be major procedures: embedding, detection and recovery
described is the hierarchical digital watermarking procedures. The embedding procedure describes how the
technique for tamper detection and recovery. This scheme watermark is embedded into each pixel's least significant
was proposed by Lin et al. [5]. In this research method, the three bits in the original image. The tamper detection
original image was divided into non-overlapping blocks of procedure aims to localize the tampered areas, and finally,
size 4 × 4 pixels. Each block is divided into sub-blocks the recovery procedure is an attempt to recover the areas
with a size of 2 × 2 pixels. For each sub-block, the that have been tampered with. The details of the proposed
watermark length is 8 bits. 6 bits out of 8 watermarks are schemes are described as follows.
related to the recovery bit, resulting from the average A. The embedding procedure
block intensity. The other 2 bits are related to the
First, the grayscale image is divided into sixteen
authentication bit. Watermark bits are embedded in the
independent parts: eight white and eight black parts. The
two least significant bits per pixel. In the tamper detection
parts are divided in such a way that two parts of the same
step, a hierarchical method is used. At level 1, each block's
color are never placed next to each other, exactly like a
sub-blocks are checked so that if the extracted
chessboard Fig.2. Commonly, the grayscale intensity is
authentication bits matched the generated authentication
stored as an 8-bit integer giving 256 possible different
bits, it would be marked as a valid sub-block; otherwise, it
shades of gray from black to white. As mentioned in
will be marked as an invalid sub-block. In level 2, a block
Section II, Hamming (7,4) encodes four bits of data into
is invalid if any of its sub-blocks is marked as invalid in
seven bits by adding three parity bits. That being said, each
level 1. At level 3, valid blocks in level 2 are checked. If
pixel of the gray image contains eight bits, of which four
these blocks have five or more invalid blocks in their 3×3
most significant bits are used for the data bits and three
neighborhood, they will be marked as invalid. Accuracy in

Authorized licensed use limited to: East Carolina University. Downloaded on June 16,2021 at 09:36:09 UTC from IEEE Xplore. Restrictions apply.
D4 D3 D2 P3 D1 P2 P1

Fig. 1. The arrangement of databits and check bits

Fig. 3. Four MS-Bits and LS-Bits of mirror pixels in top and bottom parts,
respectively during first round of embedding

TABLE 1. CHECK BITS AND POSITION IN EMBEDDING( FIRST ROUND)

Generation check bit bit position for


Fig. 2. The arrangement of the white and black parts next to each other Embedding
check bit
least significant bits are replaced with the check bits. The = ⊕ ⊕ ⊕ =
fifth most significant remains unused yet. If information = ⊕ ⊕ ⊕ =
from the fifth most significant bit is not recorded in the
watermarked image, the image recovery will be weakened. = ⊕ ⊕ ⊕ =
To solve this problem, we also consider the fifth bit of the = ⊕ ⊕ ⊕ =
part's pixel that did not participate in the check bit's
embedding as a data bit. The check bits are calculated = ⊕ ⊕ ⊕ =
using the following statement = ⊕ ⊕ ⊕ =
= ⊕ ⊕ ⊕
= ⊕ ⊕ ⊕ (3)
= ⊕ ⊕ ⊕ = ⊕ ⊕ ⊕ =
Four parts of one color are chosen, supposing these four = ⊕ ⊕ ⊕ =
parts are the four white parts at the top of the image. At the
first round and first iteration, the first most significant bits = ⊕ ⊕ ⊕ =
are extracted from the first pixel of each of the four = ⊕ ⊕ ⊕ =
independent parts. These four bits are considered as data
bits. The eighth white part does not participate in the check = ⊕ ⊕ ⊕ =
bit's embedding, so the fifth bit of the first pixel of this part = ⊕ ⊕ ⊕ =
is considered as the data bit too. At this point, the checked
bit is generated and is embedded in the least significant bit
of the first pixel of the fifth, sixth, and seventh white part, represent zth (1,2,3) bit of check bits. represents
which are in the lower half of the image. So, this procedure one bit of the data bits, C denotes which color is W(white)
is performed for all the pixels of these parts. Follow Table or B(black).
1 to find out the data bits and the check bits' location in the Additionally, i and j are the part number and the
second, third and fourth iterations. In continuation, for the position of bit in pixel, respectively.
second, third and fourth rounds, the other 12 white and represents the bit location that relative parity
black parts are placed in one category in turn then, for each check would be embedded.
category, four iterations that being said are performed. In the next step, we select four bits of data bits from
For a better understanding and according to Fig.2 and four white parts in the lower half of the image and embed
Fig.3, the procedure is shown in Table 1. in detail. It them in three white parts from the upper half image. If you
represents how each check bit is generated and shows in want to adapt this procedure to Table 1, just change the
which part it is embedded based on (4) value of i from 1,2,3,4,5,6,7,8 to 5,6,7,8,1,2,3,4,
respectively. To complete the embedding phase,
= ⊕ ⊕ ⊕ (4) everything that was done for the white parts must be
= carried out for the black parts as well. To adapt this
procedure to Table 1, just change C from white to black.

Authorized licensed use limited to: East Carolina University. Downloaded on June 16,2021 at 09:36:09 UTC from IEEE Xplore. Restrictions apply.
bit in the Hamming code structure. Therefore, no decision
is made on the error bit and the decision is postponed to
the next level. In the second level, the state that Syndrome
vector is equal to [1 1 1] is checked. In this case, of the two
candidate bits, we consider that bit as the damaged bit
which has a larger number of tampered pixels in the
neighborhood of 3 × 3 pixels around it, and finally, we
mark that pixel as the tampered pixel including a bit error.
It is essential to remember that the tampered pixels to
(a) (b) consider the 3×3 neighbors of each pixel are marked from
Fig. 4. (a) The “Lena” image, (b) Watermarked image
the first level.
C. The tamper recovery procedure
In the recovery phase, the Syndrome vector is required
which indicates the tampered bit, as mentioned earlier. The
vectors with the opposite values of [0 0 0] and [1 1 1] are
checked and the tampered bit is toggled according to
Syndrome vector's value. Now it's time to check the status
of the Syndrome vector. When it equals [1 1 1], there are
two candidate bits for tampered bits. To choose between
these two bits, select the bit whose pixel in the detection
phase has been marked as a tampered pixel, then toggle the
(a) (b)
selected bit. The result of this phase is a very high-quality
recovered image. Each distributed Hamming code is made
up of eight bits that are in eight separate and independent
parts. On the other hand, in Hamming code technology,
only one modified bit can be corrected, so if only one part
is tempered, the image will be completely reconstructed. It
is also clear that the distributed Hamming code in the
white and black parts work independently, so in general, if
only one white part and one black part have tempered, the
image can be recovered perfectly.
(c)
Fig. 5. (a) The tampered “Lena” image(in 10% tampered), (b) The V. EXPERIMENTAL RESULTS
detection “Lena” image ,(c) The recovery “Lena” image
In this section, some experimental results are given
B. The tamper detection procedure which indicate the validity of the proposed scheme in both
tamper detection and tamper recovery. For quantitative
Tamper detection is conducted at two levels. At the first
evaluation, peak signal-to-noise ratio (PSNR), was
level, the image is divided into sixteen independent parts,
introduced to evaluate the PSNR of image relative to
exactly as in the embedding phase. To localize the
image . PSNR is defined as
tampered area, we must first generate the Syndrome vector
as described in section II. PSNR = 20× ( ) (6)
√ !"
The bits and the relationship between them to generate MSE = ∑ , ∑%, | ((, *) − ((, *)| (7)
the Syndrome vector must be exactly the same as that used ∗%
The symbols (i , j) and (i , j) represent the pixel values
in the embedded step. For instance, consider the first row
of Table 1 to generate the S vector according to the bits at the position (i, j) in the image and the image,
mentioned, the following calculations must be respectively. The symbols M and N represent the pixel
implemented. numbers for the width and the height of the image,
respectively.
= ⊕ ⊕ ⊕ ⊕
In the current investigation, the Lena image of size
= ⊕ ⊕ ⊕ ⊕ (5) 512*512 was used for the experiments, as illustrated in
Fig.3 (a). The watermarked Lena image, which is given in
= ⊕ ⊕ ⊕ ⊕ Fig.3 (b), is having PSNR values of 38.06 dB.
If the Syndrome vector is equal to [000], we find that no The proposed method has significant results in tamper
error has occurred; otherwise, the Syndrome vector’s detection and correction, particularly if the tempered size
value, indicates the bit in which the error occurred. If there does not exceed two adjacent parts. Figure 4 (a) shows the
is any error bit (bit which is inconsistent based on image with 10% of the tamper, Figure 4 (b) indicates the
Hamming) in the pixel, that pixel is marked as the detection of the tamper, and finally Figure 4 (c), represents
tampered pixel. This procedure is done for the whole the recovered image.
image to localize the tampered area. It is important to note Table 2 and Table 3, list the PSNR of the recovered
that when the Syndrome vector is equal to [1 1 1], there image relative to various tampered sizes to further
are two candidate bits to consider the error event in those demonstrate the performance of the proposed scheme.
bits. The reason is that the fifth bit was added as the data

Authorized licensed use limited to: East Carolina University. Downloaded on June 16,2021 at 09:36:09 UTC from IEEE Xplore. Restrictions apply.
TABLE 2. THE PSNR OF THE RECOVERED IMAGE RELATIVE TO THE TAMPERED SIZE VI. CONCLUSION
Paper Embedding PSNR (dB) of In this paper, a novel fragile watermarking method has
rate Recovered image
been proposed to detect tamper area in the image and
Ref [8] 3 51.97 recover the tampered areas based on Hamming code.
method #1
Encoding of Hamming (7,4) has been applied to generate
Ref [8] 3.25 52.90
method #2
authentication code and decoding of Hamming (7,4) has
been used to detect and recover tampered pixels. Also, the
Ref [8] 3.49 53.42
method #3 LSB technique has been employed for embedding. LSB
Ref [8] 4
data hiding technique does not affect the visible properties
∞ of the image, thus, the authentication code embedding
method #4
Proposed 3 procedure preserves the high visual quality of the

method watermarked image. Experimental results show that if the
image is tempered up to 12.5% and the tamper's diameter
is sufficiently small; our method recovers it perfectly.
TABLE 3. THE PSNR OF THE RECOVERED IMAGE RELATIVE TO THE TAMPERED SIZE Also, in percentages higher than 12.5% of the temper,
better results compared to some other state-of-the-art
10% 20% 25%
Paper
Tampered tampered Tampered
works have been achieved. Extending the work to support
Ref 6 35.17 - 33.45 more than one bit modification per distributed pixel,
improving the embedding PSNR, increasing the upper
Ref 10 45.85 - - bound of the tamper for perfect reconstruction and
37.50 - 33.95
extending the proposed method for two-check-bits
Ref 11 embedding may be considered in the future.
Ref 12 38.69 37.15 -
REFERENCES
Ref7 41.10 39.45 -
[1] Singh, Satendra Pal, and Gaurav Bhatnagar. "A new robust
(Quad method)
watermarking system in integer DCT domain.," Journal of Visual
Proposed method ∞ 39.44 37.16 Communication and Image Representation 53, pp.86-101, May 2018.
(condition #1)
Proposed method 49.09 39.44 37.16 [2] Kang, Xiaobing, Yajun Chen, Fan Zhao, and Guangfeng Lin. "Multi-
(condition #2) dimensional particle swarm optimization for robust blind image
watermarking using intertwining logistic map and hybrid domain," Soft
Computing, 24(14), pp.10561-10584, jul 2020.
Table 2 shows the PSNR of the recovery image of Chan [3] Sikder, Imran, Pranab Kumar Dhar, and Tetsuya Shimamura. "A semi-
and Chi-Shiang's [8] proposed schema. In their method, fragile watermarking method using slant transform and LU
the image size is 512*512, and the tamper size is 64*64. decomposition for image authentication." International Conference on
Electrical, Computer and Communication Engineering (ECCE). IEEE,
The embedding rate indicates the average number of bits pp. 881-885, Feb 2017.
used to embed the authentication data. The higher the [4] Hamming R. W. " Error detecting and error correcting codes. " Bell
value of the embedding rate, the lower the value of PSNR Sysr. Tech. J, 29, 1950.
in the embedding stage. The result of method#4 recovers [5] Lin, Phen Lan, Chung-Kai Hsieh, and Po-Whei Huang. "A hierarchical
the image perfectly, but in the embedding phase, the PSNR digital watermarking method for image tamper detection and
value decreases. In contrast, the proposed method recovery." Pattern recognition 38, no. 12, pp.2519-2529 , Dec 2005.
maintains the PSNR value with three bits watermark for [6] Lee, Tien-You, and Shinfeng D. Lin. "Dual watermark for image
tamper detection and recovery." Pattern recognition 41, no. 11,
each pixel and achieves this result. pp.3497-3506 , nov 2008.
Table 3 demonstrates the results of our proposed [7] Sarkar, D., S. Palit, S. Som, and K. N. Dey. "Large scale image tamper
method compared to the methods presented by other detection and restoration." Multimedia Tools and Applications, , pp.1-
researchers. The results indicate a higher PSNR value in 31, Feb 2020.
our proposed method. There are two rows in this table to [8] Chan, Chi-Shiang. "An image authentication method by applying
demonstrate the PSNR of the recovered image relative to Hamming code on rearranged bits." Pattern Recognition Letters 32, no.
14, pp.1679-1690, Oct 2011.
our proposed method that values are different in the first
[9] Chan, Chi-Shiang, and Chin-Chen Chang. "An efficient image
column. The reason for this difference is to consider two authentication method based on Hamming code." Pattern Recognition
conditions to define the tamper's area. In conditions #1, the 40, no. 2, pp.681-690, Feb 2007.
tampered area is determined in such a way that it does not [10] Chaluvadi, Surya Bhagavan, and Munaga VNK Prasad. "Efficient
exceed the size of two adjacent parts. But in condition #2 image tamper detection and recovery technique using dual watermark."
In 2009 World Congress on Nature & Biologically Inspired Computing
there is no limitation, and the tampered area is a square (NaBIC), pp. 993-998. IEEE, Dec 2009.
environment, that the width size is larger than the width [11] Tohidi, Faranak, and Manoranjan Paul. "A new image watermarking
size of two adjacent parts. As mentioned in the recovery scheme for efficient tamper detection, localization and recovery." In
section, if at most one white part and one black part have 2019 IEEE International Conference on Multimedia & Expo
tampered, the image can be completely recovered, since Workshops (ICMEW), pp. 19-24. IEEE, Jul 2019.
there are sixteen parts in the image, in general and with [12] Ansari, Irshad Ahmad, Millie Pant, and Chang Wook Ahn. "SVD based
fragile watermarking scheme for tamper localization and self-
conditions#1, parts, Equal 12.5% of the total image can recovery." International Journal of Machine Learning and Cybernetics
7, no. 6, pp.1225-1239, Dec 2016.
be completely recovered.

Authorized licensed use limited to: East Carolina University. Downloaded on June 16,2021 at 09:36:09 UTC from IEEE Xplore. Restrictions apply.

You might also like