Input: Relational database , attribute , parameter |
Output: Watermarked relational database , Mid, and two pairs, that is, |
(PP1, CZP1) and (PP2, CZP2) |
(1) = Tuple_Selection |
(2) foreach tuple do |
(3) attribute_index mod // selected attribute |
(4) mark_bit imb = mod // determine mark bit |
(5) = Get2digits(); |
(6) insert into Seq; |
(7) insert imb into Mark_Seq; //save index of the corresponding mark bit |
(8) end foreach; |
(9) Mid = GetMid(Seq); |
(10) Dif_Seq = Diff(Seq, Mid); |
(11) determine two pairs (PP1, CZP1) and (PP2, CZP2); |
(12) generate the watermark data ; //using (4) |
(13) for to − 1 do |
(14) if Dif_Seq[] = PP2, then |
(15) = W[Mark_Seq[]]; //read the corresponding mark bit from |
(16) Dif_Seq[] = Dif_Seq[] + ; |
(17) else |
(18) if Dif_Seq[] < CZP2 and Dif_Seq[] > PP2 then |
(19) Dif_Seq[] = Dif_Seq[] + 1; |
(20) end if; |
(21) end if; |
(22) if Dif_Seq[] = PP1, then |
(23) = [Mark_Seq[]]; //read the corresponding mark bit from |
(24) ; |
(25) else |
(26) if Dif_Seq[] > CZP1 and Dif_Seq[] < PP1 then |
(27) Dif_Seq[] = Dif_Seq[] − 1; |
(28) end if; |
(29) end if; |
(30) end for; |
(31) Reflect_Update_Att(Diff_Seq, ); |