Research Article

Data Authentication for Wireless Sensor Networks with High Detection Efficiency Based on Reversible Watermarking

Algorithm 3

Decoding
Input: stream S'
Output: recovered data stream S
1. while (stream S' is not over) do
2. if (spflag ==0)
3. do steps 3~10 in Algorithm 2;
4. else if (spflag ==1)
5. CS1Si−1
6. for j ⟵1 to i−1 do
7. pe'Cj
8. wj ⟵ LSB()
9. if (wjWj)
10. marking G as failed;
11. GC//This failed carrier group becomes a new generator group;
12. break
13. else
14. Sj ⟵ (pe' − wj) /2 + //Restoring the original data;
15. end if
16.  ⟵ ( + Cj) /2
17. end for
18. end if
19. end while