Professional Documents
Culture Documents
D TAL FIN
NGERP
PRINT
TING
A
Proj
oject reportt
Sub
bmitted in the
t partial fulfilment of requireement of the award off degree off
BA
ACHELOR OF TECHN
NOLOGY
IN
ELE
ECTRONICS MMUNICA TION ENGI
CS AND COM GINEERING
G
ARJUN
A DEV
VGAN (B0770279EC)
CHALLA HIMANS
SHU REDD
DY (B0703199EC)
NA
ASREEN MOHSIN
M (B0070495EC)
SHYAM
S AS
SHISH (B0770287EC)
AJITH K G (B0600779EC)
Departm
ment of Ellectronics and Comm
municatioon Engineeering
NATIONAL INIS
STITUTE OF TECH GY, CALICUT
HNOLOG
Kozhikode,
K Kerala-
K 6736601, India
CERTIFICATE
Project Guide
Department of Electronics and
Communication Engineering
N.I.T Calicut
Dr. P. C. Subrahmaniam
1. ABSTRACT ........................................................................................................... 1
8.1.4 Checking if the image is colluded, locking it and tracing the ...................
colluders. ................................................................................................ 22
10. CONCLUSIONS
29
TABLE OF FIGURES
1
collusion that all attackers share the same risk of being captured, we analysed the
maximum number of colluders that the fingerprinting systems can withstand, and our
results showed that multimedia fingerprints can survive collusion attacks by a many
dozens of colluders.
2
2. NEED OF DIGITAL FINGERPRINTING
These forecasts emphasize the growing need of content and rights holders to
identify copyrighted content as it moves across computers and mobile phones around
the world. Media owners are today looking for ways to track and control the
distribution of their content on the broadcast television and the internet. They are also
looking at new ways to develop business models with digital publishing platforms
such as UGC or social network sites, in order to monetize their content, including
through advertising revenue sharing. Content publishing companies, in turn, are
looking for means to expand their business in advertising and to offer additional
services that generate real revenues. There is a clear need for technology that enables
flexible business rules to be applied to online content and which fits seamlessly into
the established content-to-consumer delivery chain. Digital Fingerprinting meets
this need.
3
3. WHAT IS DIGITAL FINGERPRINTING?
4
4. COLLUSION ATTACKS
sufficient to defeat the underlying watermarks, where N is the total length of the
fingerprint signal.
We consider a more general linear attack where the colluders employ multiple
input/ single-output linear shift-invariant (LSI) filtering plus additive Gaussian noise
to thwart the orthogonal fingerprints. Under the assumption that all fingerprints are
independent and have identical statistical characteristics, it was shown that the
optimal LSI attack involves each user weighting their marked document equally prior
to the addition of additive noise.
5
Figure 1:
1 Model forr collusion by
b averagingg.
When thee fingerprinnt is spread throughoutt the entire host signall by such
technniques as sp
pread-spectrrum embeddding and detected
d throough some form of
correlation, the cu
ut-and-pastee collusion attack
a has an effect that iis similar to averaging
collusion. In bothh cases, the energy of each
e contribbuting fingerrprint is reduuced by a
factorr correspon
nding to thee amount of copies innvolved in tthe collusioon. As an
exam
mple, if Alice contributees half of her samples to a cut-andd-paste colluusion, the
energgy of Alicee’s fingerpriint in the colluded
c coopy is only half of heer overall
fingerprint energ
gy. As a ressult, the corrrelation of the colludedd signal witth Alice’s
fingerprint is ro
oughly halff the correllation of ann un-colludded copy of
o Alice’s
fingerprinted siggnal with hher fingerprrint. Thereffore, when considering
g spread-
specttrum embed
dding, we may
m consideer cut-and-ppaste collussion as anallogous to
averaaging collusiion.
4.2 Nonlinea
ar Collusion
6
examine families of nonlinear collusion attacks. An important class of nonlinear
collusion attacks is based upon such operations as taking the maximum, minimum,
and median of corresponding components of the K colluders’ independent
[10] [18]
watermarked copies. For simplicity in analysis, nonlinear attacks are typically
assumed to be performed in the same domain of features as the fingerprint
embedding.
[18]
The efficacies of different attacks that were studied were based on two
performance criteria: the probability of capturing at least one colluder Pd and the
probability of falsely accusing at least one innocent user Pfp. Since the colluded
fingerprint components under the minimum, maximum, and randomized negative
attacks do not have zero mean, pre-processing was applied to remove the mean from
the colluded copy. It was observed that the overall performance under the median or
7
minm
max attacks is comparaable to that of the averrage attack. Therefore, from the
attackker’s point of
o view, therre is no gainn in employiing the meddian or minm
max attack
comppared to the average atttack. On the other hannd, the effecctiveness of collusion
improoves under the minim
mum, maxim
mum, and m
modified neegative attaacks. The
randoomized negaative attack was shownn to be the most
m effectiive attack, but
b it also
introdduces largerr, more percceivable disttortion to thhe host signal than otheer attacks.
[18] [19]
Colluuders may also apply addditional noiise after thee nonlinear combining.
c As
the am
mount of distortion introoduced by thhe nonlinearr combiningg increase, thhe amount
of addditional no
oise that caan be addedd while maaintaining pperceptual constraints
c
decreeases.
8
5. ROBUST DATA EMBEDDING
9
with extracting features from a media signal in question. Then the similarity between
the features and a watermark is examined to determine the existence or absence of the
watermark in the media signal. Typically, a correlation similarity measure is used,
often in conjunction with pre-processing (such as whitening) and normalization. [1]
10
6. ANTI-COLLUSION CODED FINGERPRINTING
Both encoding and embedding issues should be taken into consideration when
designing fingerprints for multimedia that can survive collusion and identify
colluders. Since it is desirable to design the fingerprints using as few underlying basis
signals as possible, we approach the design of -resistant fingerprints using code
modulation. [8]
The fingerprint signal wj for the jth user is constructed using a linear
combination of a total of v orthogonal basis signals {u } such that = ∑ .
and we are able to represent = users with these v basis vectors. Therefore, for
11
users. There are systematic methods for constructing infinite families of BIBDs which
thus provide a vast supply of ACC.
Let us now study a simple example of ACC codes. The columns of the
following matrix C represent the code-vectors of an ACC built from a (7, 3, 1)-BIBD.
0 0 0 1 1 1 1
0 1 1 0 0 1 1
1 0 1 0 1 0 1
C= 0 1 1 1 1 0 0
1 1 0 0 1 1 0
1 0 1 1 0 1 0
1 1 0 1 0 0 1
w1 = −u1 − u2 + u3 − u4 + u5 + u6 + u7,
w2 = −u1 + u2 − u3 + u4 + u5 − u6 + u7,
.
.
.
w7 = +u1 + u2 + u3 − u4 − u5 − u6 + u7.
Upon examining the code matrix C, we see that the logical AND of any two or
fewer code-vectors is distinct from the logical AND of any other two or fewer code-
vectors. When two watermarks are averaged, the locations where the corresponding
ANDACC agree and have a value of one identify the colluding users. For example,
the w1 and w2 shown above represent the watermarks for the first two columns of the
above code, where we use the antipodal form and map “0” to “−1.” The average
(
has coefficient vector (−1, 0, 0, 0, 1, 0, 1). The fact that a “1” occurs in the
fifth and seventh location uniquely identifies user 1 and user 2 as the colluders.
12
only users 1, 4, and 8 can pproduce a seet of sustainned 1’s at thhe fifth, sixtth, eighth,
tenth, 14th, and 16th
1 code bitts.
13
7. FINGERPRINT CODE CONSTRUCTION SCHEME USING
GROUP-DIVISIBLE DESIGN
Because different fingerprint codes are embedded into identical contents, the
embedded contents are slightly different from each other. Using this characteristic, an
averaging attack can eliminate the embedded codes. An averaging attack is an attempt
to remove the embedded fingerprints by averaging several copies. An averaging
attack attenuates the embedded codes while maintaining the original content. The uses
of an averaging-resilient fingerprint code can prevent an averaging attack. The main
issue of the anti-collusion fingerprint code is a practical construction problem. A new
fingerprint code set derived from a group-divisible partially balanced incomplete
block design (GD-PBIBD) is useful from an application point of view.
The fingerprint codes generated using the above steps play an important role
in a digital fingerprinting system that is robust to an averaging attack. The final
incidence matrix of the GD-PBIBD is a set of anti-collusion fingerprint codes that can
be distributed to customers, i.e., each column of the matrix is unique fingerprint code
for each customer. This code has the “ANDACC” property that enables the chasing of
[35]
colluders after an averaging attack, as described by W. Trappe. The code is
modulated to noise-like fingerprint patterns, which are embedded into digital contents.
14
7.2 General GD-PBIBD Matrix
T27x81 =
0110110.............1101110
1011011.............1110011
1101101.............0011101
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
1111111.............1111111
0110110.............1111111
1011011.............1111111
15
7.3 Removal of Flaw of Periodicity in GD-BIBD Codes
A general GD-BIBD code itself has a peculiar flaw. When the number of the
consumers increases the codes generated for user tend to repeat in periodic manner. In
order to overcome this flaw some adjustments have been made. For all the users the
user-specific code is attached with a header and a tail. These headers and tails are
again user-specific meaning they do not repeat themselves anywhere. By the help of
these headers and tail, the complexity of chasing the colluders will be decimated
drastically.
The consumers are divided into equal groups of s2, each having a specific tag
and each consumer in the group is also assigned with another tag. The group tag is
used as the tail and the user tag is used as the header. In this way no two consumers
will be provided with a same fingerprinting code in their digital media.
We introduced a header string and a tail string of length s2 to each of the rows
of the matrix T and eliminated the periodicity and duplicity of any row in the U
matrix. These header and tail strings are created in such a way that each user has a
unique pair of them. For an ith group, a zero is placed in the ith position in the tail
string in reverse direction. Similarly for a user who is in jth position in a group, a zero
will be placed in the jth position in the header string in reverse direction.
For eg. A user of 6th group having 3rd position in it will have the header string
as 111…1011 and the tail string as 111…011111.
16
8. COLLUDER IDENTIFICATION
There are many potential colluder identification schemes. Due to the discrete
[8]
nature of the ACC fingerprinting code, the maximum likelihood (ML) approach
usually involves the enumeration of all possible parameter values, which leads to
prohibitively high computational requirements. Therefore, computationally efficient
alternatives to the ML algorithm are desirable. Three detection schemes have been
recently proposed as suitable candidates that may be applied with AND-ACC. [24] The
first scheme is a hard-threshold detector, which starts with comparing TN(i), the
correlation-based detection statistic for each bit, to a threshold τ to decide the
observed code bit. If the threshold is chosen appropriately, the extracted code
approximates the AND operations of the codes from the colluders. We then compare
the decoded bits with the ACC code-vectors and use the detected “1” bits to deduce
which users have been involved in collusion.
The second approach is a soft threshold scheme, called the adaptive sorting
detector, where the descending ordered detection statistics TN(i)s are iteratively used
to narrow down the set of suspected users until the likelihood function stops
increasing. The third scheme that was introduced, known as sequential detector,
differs from the previous two algorithms in that it attempts to directly estimate the set
of colluders from the distributional behavior of the detection statistics instead of first
performing decoding before identifying colluders from the decoded fingerprint code.
As indicated by the name, the sequential detector identifies colluders one by one using
a likelihood criterion. These three detectors have much lower computational
complexity than the ML approach. Simulation results of these detectors under a three-
colluder scenario are presented in Figure 7, where fingerprints based on a (16, 4, 1)
BIBD are employed.
17
suspiicion. Overaall, the sequuential deteector providdes the mosst promising
g balance
betweeen capturin
ng colluders and placingg innocents under suspicion. From
m the code
persppective, this performance
p e improvemeent can be viewed as usiing not only sustained
1 bitss but also susstained 0 bitts to help ideentify colludders.
18
8.1 Observattions
Figure 5: Owner
O infoormation em
mbedded image
19
8.1.2 Embeddiing the fingeerprint intoo the image.
Original im
mage. Colludded image
Fingerprinnted image
20
8.1.3 Extraction of watermarking from image.
marked image
21
8.1.4 Checking if the image is colluded, locking it and tracing the colluders.
For eg., An un-colluded image the header string will be of the form 111111…110
and the tail string will be as 111011…111.
When the analysed string is found having two or more zeros in either of the
strings, the image is immediately locked and all the possible users that can be
involved in the collusion are listed out. Then many combinations of these users are
used and an averaging attack is done with them, in each case generating a new
colluded code. Now these codes are compared with the actual colluded code, resulting
in only one match. And thus any user involved in the collusion can be identified with
no errors.
111101100101101101111111111101110011111110001
When the code is checked the 3 zeros in the header string is identified and the
image is locked and becomes inaccessible. Then based on the position of zeros in the
header and the tail strings, all probable colluders are listed out.
22
In our case the possible colluders are.
14 23 32
11 20 29
10 9 28
Now for possible combinations of these users, different colluded codes are
generated. To simplify the understanding 27 of all the possible codes are listed below.
111101111101101101101011110101110011111110001
111101101111111111101011110101110011111110001
111101110111111111101011110101110011111110001
111101101101101101101011110101110011111110001
111101101101101101101011110111111111111110001
111101100101101101101011110111111111111110001
111101110001001001101011110101110011111110001
111101100011011011101011110111111111111110001
111101110011011011101011110111111111111110001
111101101101101101101011110101110011111110001
111101101101101101111111111101110011111110001
111101100101101101111111111101110011111110001
111101101101101101101011110101110011111110001
111111101101101101111111111111111111111110001
111111100101101101111111111111111111111110001
111101100001001001101011110101110011111110001
111111100001001001111111111111111111111110001
111111100001001001111111111111111111111110001
111101110001001001101011110101110011111110001
111101100011011011111111111101110011111110001
111101110011011011111111111101110011111110001
111101100001001001101011110101110011111110001
111111100001001001111111111111111111111110001
111111100001001001111111111111111111111110001
111101110001001001101011110101110011111110001
111111100011011011111111111111111111111110001
111111110011011011111111111111111111111110001
For the above table we can notice that the 12th combination, which is of the
users 11, 23 28 is the only exact match to the colluded code.
23
9. JOINT FINGERPRINTING EMBEDDING AND
ENCRYPTION (JFE)
In encryption, the signs of some of the DCT coefficients’ are encrypted and
the others are left unchanged. Here the amplitudes are left unchanged. In decryption,
the signs are decrypted for restoration. Each different key produces the copy with
different signs left unchanged. The position of the left signs determines the
uniqueness of the encrypted data. The process is shown in the following figure.
24
Original bllock Encryypted block D
Decrypted block
b
Figgure 8: JFE
E Scheme Exxample
Figure 9:
9 Fingerprrint embedd
ding schemee.
25
The binary fingerprint analysis is conducted on the host on order to determine
the depth or strength of embedding that provides a good tradeoff between
imperceptibility and robustness and code word length bits. The fingerprint
codewords are modulated, which involves the use of signal processing strategies to
form a signal ∈ , for i=1, 2, 3… n that can be added imperceptibly to the host
media with the help of human perception models. Fig. 7 shows the process of
fingerprint embedding. The modulated version of the fingerprint is often called a
watermark in the research literature, which has a distinct objective from the copyright
watermark previously discussed. For simplicity from now on our use of the term
“watermark” unless otherwise specified will apply to the modulated fingerprint and
not .
26
9.2 Fingerprinting Requirements
27
Figure 10: Overview of
o video secu
urity, distriibution and piracy proccess
28
10. CONCLUSIONS
29
11. APPENDICES
Appendix A: Embedding of Fingerprint in and Image and Formation Of
Colluded Copy
clf;
clc;
% lena = imread('lena512.bmp');
% lena =double(lena);
%
% I=dct(lena);
A = im2double(imread('lena512.bmp'));
D = dctmtx(size(A, 1));
dct = D*A*D';
L=idct2(dct);
figure(1);
imshow(L);
[m, n]=size(dct);
z=zeros(m, n);
x=[-1 -1 1 -1 1 1 -1 zeros(1, n)];
for i=1:n
z(1, i)=x(i);
end;
% lena1=idct(I);
% imshow(lena1);
dct4=dct*(eye(n)+.4*z');
I=idct2(dct4);
figure(2)
imshow(I);
I5=A-I;
figure(3)
imshow(I5);
30
Appendix B: Embedding Of Watermarked In Image For Owner Identification
I2=imread('marked.bmp');
figure;
imshow(I2);
title('marked image');
N1=256;
31
N2=256;
n1=N1/8;
n2=N2/8;
for a=1:n1
for b=1:n2
f{a, b}=I2(((a-1)*8+1):(a*8), ((b-1)*8+1):(b*8));
F{a, b}=dct2(f{a, b});
end
end
Q=intensity(F);
w=pick_up(F, Q);
for j=1:64
for i=1:64
W(i, j)=w((i-1)*64+j);
end
end
figure;
subplot(1, 2, 1);
imshow(W);
title('picked out watermark');
W=Torus(W, 44);
subplot(1, 2, 2);
imshow(W);
title('resumed watermark');
imwrite(W, 'Wpick.bmp', 'bmp');
save Wpick W;
32
Appendix C: Extraction Of Embedded Watermarked
clear
close all
W=imread('watermark.bmp'); % watermark
W=rgb2gray(W);
W=im2bw(W, 0.5);
subplot(1, 2, 1);
imshow(W);
title('original watermark');
W=Torus(W, 20);
subplot(1, 2, 2);
imshow(W);
title('watermark after torus transform');
size1=size(W);
M1=size1(1);
M2=size1(2);
w=zeros(1, M1*M2);
for j=1:M1
for i=1:M2
w((i-1)*M1+j)=W(i, j);
end
end
I=imread('lena.jpg'); % image 256*256
figure;
subplot(1, 2, 1);
imshow(I);
title('original image');
size2=size(I);
N1=size2(1);
N2=size2(2);
n1=N1/8;
n2=N2/8;
for a=1:n1
for b=1:n2
f{a, b}=I(((a-1)*8+1):(a*8), ((b-1)*8+1):(b*8));
F{a, b}=dct2(f{a, b});
end
end
Q=intensity(F);
F=embed(F, Q, w);
%
I2=zeros(256, 256);
for n=1:N2/8
for m=1:N1/8
f{m, n}=idct2(F{m, n}/255);
I2((m*8-7):m*8, (n*8-7):n*8)=f{m, n};
end
end
subplot(1, 2, 2);
imshow(I2);
title('marked image')
imwrite(I2, 'marked.bmp', 'bmp');
save marked I2;
33
Appendix D: Generation of modified GD-PBIBD code database
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <conio.h>
class Tmatrix
{ private : int *e, size1,size2;
public : Tmatrix(void) {size1=size2=0;}
void Create(int s) { Create(s,s);}
void Create(int s1, int s2)
{size1=s1;size2=s2;e=new int[size1*size2];}
~Tmatrix(void) { delete e; }
void Put(int v, int i, int j)
{e[i*size2+j]=v;}
int Get(int i, int j) { return
e[i*size2+j];}
};
int s,p,MAXUSERS,ucodelength,ugrouplength,z[7*7*7*7];
// in order not to miss any parametes, the following
function must be called
34
void getandcomputeglobalparameters(int & s,int & p,int &
MAXUSERS,int & ucodelength, int & ugrouplength)
{ int t,temp1;
cout<<"Enter value 3 or 5 or 7 for s ";
cin>>s;
//Value of p is taken as 3
p=3;
MAXUSERS =1;
for(t=1;t<=2*(p-1);t++)MAXUSERS *= s;
//ucodelength=binarystringlength(MAXUSERS-1);
ugrouplength=4;// but changed as follows
ucodelength=binarystringlength(MAXUSERS-1);
ugrouplength=binarystringlength(s*s);
temp1=s*s*s+ucodelength+ugrouplength; // s*s groups
t = temp1 - 8*(temp1/8);
if(t>0)ugrouplength +=(8-t);
return;
}
void getspecificusers(int & n)
{
int i,k,satisfied;
int b;
cout<<"How many users do you want (between 1 and
"<<MAXUSERS<<") ";
cin>>n;
for (k=0;k<n;k++)
{ satisfied=0;
while(!satisfied)
{ cout<<"Enter number of the user "<<k+1<<" :
(in the range of 1 TO "<<MAXUSERS<<" .. ";
cin>>b;
z[k]=b-1;
if(z[k]<0||z[k]>MAXUSERS-1)
cout<<"Invalid user number. Input
again:\n";
else satisfied=1;
for(i=0;i<k;i++)if(z[k]==z[i]){cout<<"Duplicate!! Not
permitted. Enter again please\n";satisfied=0;break;}
}
}
return;
}
void userscodesgroupswork(int n)
{
int i,k;
cout<<"\nUnique codes for the "<<n<<" users with
group ids are displayed here\n";
for(k=0;k<n;k++)
{
cout<<"\nuser-"<<z[k]<<" :
"<<binarystring(z[k],ucodelength)<<"<";
for(i=0;i<s*s*s;i++)cout<<N.Get(i,z[k]);
cout<<">"<<binarystring(1+z[k]/(s*s),ugrouplength)<<"\n";
// hashed into [1,s*s] interval
}
}
35
void userscodesgroupsworkinfile(int n, char *nature, char
filename[])
{
int i,k,h,q,m;
FILE *f;
f=fopen(filename,"w");
i=0;
for(k=0;k<n;k++)
{
h=1+z[k]/(s*s);
m=1+(z[k]%(s*s));
for (q=0;q<((s*s)-m);q++)fprintf(f,"1");
fprintf(f,"0");
for (q=0;q<m-1;q++)fprintf(f,"1");
for(i=0;i<s*s*s;i++)fprintf(f,"%d",N.Get(i,z[k]));
for (q=0;q<((s*s)-h);q++)fprintf(f,"1");
fprintf(f,"0");
for (q=0;q<h-1;q++)fprintf(f,"1");
fprintf(f,"\n");
}
fclose(f);
}
void getrandomusers(int & n)
{
int i,j,k,max,count;
float vv;
do { count=rand()/100; }
while(count<10||count>=MAXUSERS);
max=0;
for(i=0;i<count;i++){do k=rand(); while(k<1000);
z[i]=k; if(max<k)max=k;}
for(i=0;i<count-
1;i++)for(j=i+1;j<count;j++)if(z[i]>z[j]){k=z[i];z[i]=z[j
];z[j]=k;}
// distribute z's from 0 to MAXUSERS - 1
for(i=0;i<count;i++) z[i] = (int)((MAXUSERS-1) *
(z[i]+0.5)/max);
//now select only the distint random numbers and drop
the rest.
n=0;j=1;
do {
while(z[n]==z[j])j++;
z[++n]=z[j];
}
while(j<count);
return; // n random numbers are selected
}
void BuildM()
{
int i,j;
indexM.Create(s);
for(i=0;i<s;i++)for(j=0;j<s;j++)
indexM.Put(modulovalue(i,j,s),i,j);
36
}
void ShowM()
{ int i,j;
cout<<"Now Showing index matrix M\n";
for(i=0;i<s;i++)
{
for(j=0;j<s;j++) cout<<indexM.Get(i,j)<<" ";
cout<<"\n";
}
}
void BuildTs()
{ int i,j,k;
// create all the T matrices
T = new Tmatrix[s];
T[0].Create(s);
for(i=0;i<s;i++)for(j=0;j<s;j++)T[0].Put((i!=j),i,j);
// cyclic rotation is done now.
for(k=1;k<s;k++)
{ T[k].Create(s);
for(i=0;i<s;i++)
{ for(j=0;j<s-1;j++)T[k].Put((T[k-
1].Get(i,j+1)),i,j);
T[k].Put(T[k-1].Get(i,0),i,s-1);
}
}
}
void ShowTs()
{ int i,j,k;
for(k=0;k<s;k++)
{ cout<<"Now showing T"<<k<<"\n";
for(i=0;i<s;i++)
{
for(j=0;j<s;j++)cout<<T[k].Get(i,j)<<" ";
cout<<"\n";
}
}
}
void BuildTp()
{ int i,j,k,pp,qq,u;
Tp.Create(s*s,s*s);
for(i=0;i<s;i++)
for(j=0;j<s;j++)
{ k=indexM.Get(i,j);
for(pp=0;pp<s;pp++)
for(qq=0;qq<s;qq++)
Tp.Put(T[k].Get(pp,qq),i*s+pp,j*s+qq);
}
}
void ShowTp()
{ int i,j,pp,qq;
cout<<"Now showing Tparent\n";
pp=1;qq=1;
for(i=0;i<s*s;i++)
37
{
for(j=0;j<s*s;j++)
{ cout<<Tp.Get(i,j)<<" ";
if(pp==s){cout<<" ";pp=1;} else pp++;
if(qq==s*s*s){cout<<"\n";qq=1;} else qq++;
}
cout<<"\n";
}
}
void BuildMs()
{
int i,j,k;
M = new Tmatrix[s];
for(k=0;k<s;k++)
{ M[k].Create(s);
for(i=0;i<s;i++)
{
for(j=0;j<s;j++)M[k].Put(10*i+modulovalue(1,(indexM.Get(i
,j)+k),s),i,j);
// here concatenation through decimal
arithmetic is tried. s<=7
}
}
}
void ShowMs()
{ int i,j,k;
// now show all M matrices
for(k=0;k<s;k++)
{ cout<<"Now showing M"<<k<<"\n";
for(i=0;i<s;i++)
{
for(j=0;j<s;j++)cout<<M[k].Get(i,j)<<" ";
cout<<"\n";
}
}
}
void BuildQ()
{
int i,j,k;
Q.Create(s,s*s);
for(k=0;k<s;k++)
{
for(i=0;i<s;i++)for(j=0;j<s;j++)Q.Put(M[k].Get(i,j),i,j+k
*s);
}
}
void ShowQ()
{ int i,j;
cout<<"Now showing Q\n";
for(i=0;i<s;i++)
{
for(j=0;j<s*s;j++) cout<<Q.Get(i,j)<<" ";
cout<<"\n";
38
}
}
void BuildHs()
{
int i,j,k,p,q;
H = new Tmatrix[s];
for(p=0;p<s;p++)
{ H[p].Create(s,s*s);
for(q=0;q<s;q++)
{ k=indexM.Get(p,q);
// load T[k] for the qth block
for(i=0;i<s;i++)for(j=0;j<s;j++)H[p].Put(T[k].Get(i,j),i,
j+q*s);
}
}
}
void ShowHs()
{ int i,j,k;
for(k=0;k<s;k++)
{ cout<<"Now showing H"<<k<<"\n";
for(i=0;i<s;i++)
{
for(j=0;j<s*s;j++)cout<<H[k].Get(i,j)<<" ";
cout<<"\n";
}
}
}
for(i=0;i<s*s*s;i++)for(j=0;j<s*s*s*s;j++)N.Put(1,i,j);
// Now basing on Q matrix, the N can be built with
the following logic
cout<<"\n";
39
for(qr=0;qr<s;qr++)
{
for(qc=0;qc<s*s;qc++)
{
k=Q.Get(qr,qc);
fi=k/10;si=k-fi*10;
// simple decimal logic is used without
concatenation. May not work if s>7
// and in that case Q is to be treated as
a matrix of strings
// now decide in which part which Hk is to
be loaded transposedly
// H[fi] is to be loaded in the si part
for(i=0;i<s;i++)
for(j=0;j<s*s;j++)
{
v=H[fi].Get(i,j);
x=qr*s*s+j;
y=qc*s*s+si*s+i;
N.Put(v,x,y);
}
}
}
}
void ShowN()
{ int i,j;
cout<<"N is output.\n";
for(j=0;j<s*s*s*s;j++)
{ //cout<<"For user "<<j+1<<" ";
for(i=0;i<s*s*s;i++)cout<<N.Get(i,j);
cout<<"\n";
}
}
void ShowNFILE(char *fn)
{ int i,j;
FILE *f;
f=fopen(fn,"w");
fprintf(f,"N is output.\n");
for(j=0;j<s*s*s*s;j++)
{ //cout<<"For user "<<j+1<<" ";
fprintf(f,"user%04d : ",j);
for(i=0;i<s*s*s;i++)fprintf(f,"%d",N.Get(i,j));
fprintf(f,"\n");
}
fclose(f);
}
void writeNTRANSPOSEFILE()
{ int i,j,h,q,m;
FILE *f;
char fn[10];
sprintf(fn,"%d-%d-
%d.txt",s,s*s*s*s,((s*s*s)+(2*s*s)));
f=fopen(fn,"w");
//fprintf(f,"N(%d) is output.\n",s);
for(j=0;j<s*s*s*s;j++)
{
40
h=1+j/(s*s);
m=1+(j%(s*s));
for (q=0;q<((s*s)-m);q++)fprintf(f,"1");
fprintf(f,"0");
for (q=0;q<m-1;q++)fprintf(f,"1");
for(i=0;i<s*s*s;i++)fprintf(f,"%d",N.Get(i,j));
for (q=0;q<((s*s)-h);q++)fprintf(f,"1");
fprintf(f,"0");
for (q=0;q<h-1;q++)fprintf(f,"1");
fprintf(f,"\n");
}
fclose(f);
}
void BuildMatricesSet()
{
BuildM(); // ShowM();
BuildTs(); // ShowTs();
BuildTp(); // ShowTp();
BuildMs(); // ShowMs();
BuildQ(); // ShowQ();
BuildHs(); // ShowHs();
BuildN(); // ShowN();
writeNTRANSPOSEFILE();
}
getandcomputeglobalparameters(s,p,MAXUSERS,ucodelength,ug
rouplength);
BuildMatricesSet();
cout<<"Database has been created.\n";
getspecificusers(n); // obtain n value
sprintf(tempfn,"specific users for n as %d.txt",s);
// output textfile for specific users
userscodesgroupsworkinfile(n,"Selected",tempfn);
getrandomusers(n); // obtain n value
sprintf(tempfn,"random users for n as %d.txt",s); //
output textfile for random users
userscodesgroupsworkinfile(n,"Random",tempfn);
return 0;
}
41
Appendix E: Verification of colluded image, locking of image and listing out of
possible colluders
#include <cstdlib>
#include <iostream>
42
h=h+1;
m=m+1;
}
if (h>1||l>1)
{
cout<<"The possible users involved are\n\n";
for(i=0;i<m;i++)
{ for(j=0;j<n;j++)
{
cout<<(b[j]-1)*(s*s)+a[i]<<"\t";
}
cout<<"\n";
}
cout<<"\n\n";
twozeros=1; //some problem here. need
"break" ??
}
delete fdata;
}
void getrowscolsfromgivenfile(char fname[], int & rows,
int cols)
{
int i,j,k;
int maxcols;
FILE *f;
char *fdataline;
maxcols=7*7*7+2*7*7+1024; // to be on safe side to
read a row of input
fdataline = new char[maxcols];
memset(fdataline,0,maxcols);
f=fopen(fname,"r");
k=fscanf(f,"%s^[\n]",fdataline);fgetc(f);
rows=1;
cols=strlen(fdataline);
while(!feof(f)) {
fscanf(f,"%s^[\n]",fdataline);rows++;fgetc(f);}
fclose(f);
}
43
{
cout<<"Enter the name of the locking program :
";
cin>>toexecute;
system(toexecute);\\linked to Appendix F
}
cout<<"Finished the main program\n";
return EXIT_SUCCESS;
}
44
Appendix F: Locking of the image
#include <stdio.h>
#include <stdlib.h>
#define MAXCHUNKSIZE 4096
#define MYDEBUG 0
int showlineararray( int n, int x[])
{ int i;
for(i=0;i<n;i++)printf("%3d ",x[i]);
printf("\n");
return 1;
}
int generatepermutation( int n, int x[], int skip)
{ int y[MAXCHUNKSIZE],v;
int i,j,k;
if(n>MAXCHUNKSIZE) return 0; /* failed */
for(i=0;i<n;i++){x[i]=i;y[i]=rand();}
for(i=0;i<skip;i++) rand();
for(i=0;i<n-1;i++)
for(j=i+1;j<n;j++)
if(y[i]>y[j]) { v=y[i];y[i]=y[j];y[j]=v;
k=x[i];x[i]=x[j];x[j]=k; }
if(MYDEBUG) showlineararray(n,x);
return 1; /* success.. created a permutation */
}
int encrypt( int seedvalue)
{
FILE *f, *g;
int skipvalue,bigblocks,smallblock;
int i,j,k,v1,v2,v3,fsize;
static char buff[MAXCHUNKSIZE];
int x[MAXCHUNKSIZE];
f=fopen("Colluded_Image.bmp","rb");
g=fopen("Locked.bmp","wb");
fseek(f,0,2); fsize=ftell(f);
fseek(f,0,0);fseek(f,0,0);
fread(buff,1,54,f);
for(i=0;i<54;i++)fputc(buff[i],g);
bigblocks=(fsize-54)/seedvalue;
smallblock=(fsize-54) - bigblocks*seedvalue;
skipvalue=(long) sqrt((double)seedvalue);
srand(seedvalue);
/* printf("filesize = %ld Seed value = %ld
bigblocks=%ld smallblock
%ld\n",fsize,seedvalue,bigblocks,smallblock);*/
if(bigblocks>0)
{ for(i=0;i<bigblocks;i++)
{ generatepermutation(seedvalue,x,skipvalue);
/* for every block a new permutation is generated */
for(j=0;j<seedvalue;j++)buff[j]=fgetc(f);
for(j=0;j<seedvalue;j++)fputc(buff[x[j]],g);
}
}
if(smallblock>0) {
generatepermutation(smallblock,x,skipvalue);
45
for(j=0;j<smallblock;j++)buff[j]=fgetc(f);
for(j=0;j<smallblock;j++)fputc(buff[x[j]],g);
}
fclose(f);fclose(g);
printf("Image Locked\n");
return 0;
}
int main()
{
encrypt(2000);
getch ();
return 0;
}
46
Appendix G: Generation of possible colluded codes
#include <cstdlib>
#include <iostream>
using namespace std;
47
void generatecombifiles(int rows,int cols, char
matrixdata[])
{
int i,j,k;
int uu, uunum[10],filecount,bittotal;
FILE *f;
char ch, fn[30];
filecount=0;
cout<<"How many users are considered ? ";
cin>>uu;
do
{
filecount++;
cout<<"Give "<<uu<<" user numbers please ";
for(i=0;i<uu;i++)cin>>uunum[i];
sprintf(fn,"combi%02d.txt",filecount);
f=fopen(fn,"w");
for(j=0;j<cols;j++)
{ bittotal=0;
for(i=0;i<uu;i++)bittotal+=(matrixdata[(uunum[i]-
1)*cols+j]-'0');
if(bittotal<uu)bittotal=0; else bittotal=1;
fprintf(f,"%d",bittotal);
}
fclose(f);
// we can drop the following block
cout<<"No. of users and the user nubers
selected are \n";
cout<<uu<<"\n";
for(i=0;i<uu;i++)cout<<uunum[i]<<" ";
cout<<"\n";
cout<<"The coded strings are respectively as
under \n";
for(i=0;i<uu;i++)
{
for(j=0;j<cols;j++)cout<<matrixdata[(uunum[i]-1)*cols+j];
cout<<"\n";
}
cout<<"The sum vector is as under\n";
for(j=0;j<cols;j++)
{ bittotal=0;
for(i=0;i<uu;i++)bittotal+=(matrixdata[(uunum[i]-
1)*cols+j]-'0');
cout<<bittotal;
}
cout<<"\n";
cout<<"The sum vector is reduced as under and
placed in file "<<fn<<"\n";
for(j=0;j<cols;j++)
{ bittotal=0;
for(i=0;i<uu;i++)bittotal+=(matrixdata[(uunum[i]-
1)*cols+j]-'0');
if(bittotal<uu)bittotal=0; else bittotal=1;
48
cout<<bittotal;
}
cout<<"\n";
// End of the block that can be removed
do { cout<<"Do you want to continue (y/n) ";
cin>>ch; }
while(ch!='y'&&ch!='n');
}
while(ch=='y');
}
int main(int argc, char *argv[])
{
int s,frows,fcols,db2zeros,f2zeros;
char ch, fname[20],*fdata;
char toexecute[100];
int usernum,groupnum;
int i;
49
Appendix H: Finding out the colluders
#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;
sprintf(fn,"%s%02d.txt",firstpartofnameofotherfiles,kount
);
if(loadfirstlineoffile(fn,strtocompare)<0)
break;
matched =
(strcmp(masterstring,strtocompare)==0);
if(matched) cout<<fn<<" file matched\n";
else cout<<fn<<" file did not match\n";
kount++;
}
while(1==1);
}
int main(int argc, char *argv[])
{
comparefilesfirstlines("colluded.txt","combi");
system("PAUSE");
return EXIT_SUCCESS;
}
50
12. REFERENCES
[1] I. Cox, J. Bloom, and M. Miller, Digital Watermarking: Principles & Practice.
San Mateo, CA: Morgan Kaufman, 2001.
[3] C. Podilchuk and W. Zeng, “Image adaptive watermarking using visual models,
” IEEE J. Selected Areas Commun., vol. 16, pp. 525–538, May 1998.
[4] C-Y. Lin, M. Wu, Y-M. Lui, J.A. Bloom, M.L. Miller, and I.J. Cox, “Rotation,
scale, and translation resilient public watermarking for images, ” IEEE Trans.
Image Processing, vol. 10, pp. 767–782, May 2001.
[8] J.G. Proakis, Digital Communications, 4th ed. New York: McGraw-Hill, 2000.
[11] F. Ergun, J. Kilian, and R. Kumar, “A note on the limits of collusion resistant
watermarks, ” in Proc. Eurocrypt’99, pp. 140–149, 1999.
51
[14] J.K. Su, J.J. Eggers, and B. Girod, “Capacity of digital watermarks subjected to
an optimal collusion attack, ” in European Signal Processing Conf. (EUSIPCO
2000), 2000.
[16] H. Zhao, M. Wu, Z.J. Wang, and K.J.R. Liu, “Nonlinear collusion attacks on
independent fingerprints for multimedia, ” in Proc. IEEE Int. Conf. Acoustics,
Speech, Signal Processing (ICASSP’03), Hong Kong, Apr. 2003, pp. 664–667.
[17] Z.J. Wang, M. Wu, H. Zhao, W. Trappe, and K.J.R. Liu, “Resistance of
orthogonal Gaussian fingerprints to collusion attacks, ” in Proc. IEEE Int. Conf.
Acoustics, Speech, Signal Processing (ICASSP’03), Hong Kong, Apr. 2003, pp.
724–727.
[18] M. Wu and B. Liu, Multimedia Data Hiding. New York: Springer-Verlag, Oct.
2002.
[20] W. Zeng and B. Liu, “A statistical watermark detection technique without using
original images for resolving rightful ownerships of digital images, ” IEEE
Trans. Image Processing, vol. 8, pp. 1534–1548, Nov. 1999.
[22] W. Trappe, M. Wu, Z.J. Wang, and K.J.R. Liu, “Anti-collusion fingerprinting
for multimedia, ” IEEE Trans. Signal Processing, vol. 51, pp. 1069–1087, Apr.
2003.
[24] D.Z. Du and H. Park, “On competitive group testing, ” SIAM J. Comput., vol.
23, pp. 1019–1025, Oct. 1994.
[25] D. Kirovski, H.S. Malvar, and Y. Yacobi, “Multimedia content screening using
a dual watermarking and fingerprinting system, ” in Proc. ACM Multimedia,
2002, pp. 372–381.
[26] Z.J. Wang, M. Wu, W. Trappe, and K.J.R. Liu, “Group-oriented fingerprinting
for multimedia forensics, ” to be published.
[27] D. Boneh and J. Shaw, “Collusion-secure fingerprinting for digital data, ” IEEE
Trans. Inform. Theory, vol. 44, pp. 1897–1905, Sept. 1998.
52
[28] Y. Yacobi, “Improved Boneh-Shaw content fingerprinting, ” in Proc. CTRSA
2001, 2001, pp. 378–91.
[29] J.H. Dinitz and D.R. Stinson, Contemporary Design Theory: A Collection of
Surveys. New York: Wiley, 1992.
[30] C. J. Colbourn and J.H. Dinitz, The CRC Handbook of Combinatorial Designs.
Boca Raton, FL: CRC Press, 1996.
[32] InKoo Kang, Kishore Sinha and Heung-Kyu Lee, “New Digital Fingerprint
Code Construction Scheme Using Group-Divisible Design,” IEICE TRANS.
FUNDAMENTALS, VOL.E89–A, NO.12 DECEMBER 2006.
53