www.pudn.com > hide1.rar > hide9.m, change:2004-03-05,size:1541b


function hide() 
mm=input('please input the lock password:'); 
B=imread('E:\chan\mat\gh7.jpg','jpg'); 
imshow(B);pause;close; 
[Bx,By,Bz]=size(B); 
CC=imread('E:\chan\mat\wsq.bmp','bmp'); 
imshow(CC);pause;close; 
[Cx,Cy,Cz]=size(CC); 
%%密码分解 
m(1)=fix(mm/1000); 
m(2)=fix((mm-m(1)*1000)/100); 
m(3)=fix((mm-m(1)*1000-m(2)*100)/10); 
m(4)=mm-m(1)*1000-m(2)*100-m(3)*10; 
m=m.*10 
%%构建C 
for i=8:5 
    C(i)=bitget(CC,i);  
    C1=zeros(Cx,m(9-i),Bz); 
    C(i)=[C1,C(i)]; 
    C2=zeros(m(9-i),m(9-i)+Cy,Bz); 
    C(i)=[C2;C(i)]; 
    CC1=zeros(Bx-Cx-m(9-i),Cy+m(9-i),Bz); 
    C(i)=[C(i);CC1]; 
    CC2=zeros(Bx,By-Cy-m(9-i),Bz); 
    C(i)=[C(i),CC2].*2^i;    
    C(i)=uint8(C(i)); 
    imshow(C(i));pause;close; 
end 
 
%%隐藏 
D=bitand(B,240); 
for i=1:4 
    bb(i)=bitget(B,i); 
    bb(i,((m(i)+1):(m(i)+Cx)),((m(i)+1):(m(i)+Cy)),1:Bz)=bitand(bb(i,((m(i)+1):(m(i)+Cx)),((m(i)+1):(m(i)+Cy)),1:Bz),240); 
    c=bitshift(bitand(C(9-i),240),-4); 
    DD(i)=bitor(b,c); 
    D=D+DD(i).*2^i; 
end 
    imshow(D);pause;close; 
    imwrite(D,'E:\chan\mat\d.bmp') 
    D=imread('E:\chan\mat\d.bmp','bmp'); 
%%输解码 
n=input('please input the unlock password:'); 
for i=1:100000 
    if n==m 
        break 
    else 
        sprintf('put the wrong unlock password!!!') 
        n=input('please input the correct unlock password:'); 
    end 
end 
%%提取 
n1=fix(n/100);   
n2=n-(fix(n/100))*100; 
U=bitshift((bitand(D,15)),4); 
U=U((n1+1):(n1+Cx),(n2+1):(n2+Cy),1:Cz); 
imwrite(U,'E:\chan\mat\e.bmp') 
imshow(U);pause;close; 
sprintf('ok')