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


function hide() 
m=input('please input the lock password:'); 
B=imread('E:\chan\mat\jzx.bmp','bmp'); 
imshow(B);pause;close; 
[Bx,By,Bz]=size(B); 
C=imread('E:\chan\mat\wsq.bmp','bmp'); 
imshow(C);pause;close; 
[Cx,Cy,Cz]=size(C); 
%%密码分解 
m1=fix(m/100);      
m2=m-(fix(m/100))*100; 
%%检测 
E=bitand(C,240);          
F=bitor(bitshift(bitand(C,240),-4),240); 
imshow(E);pause;close; 
imshow(F);pause;close; 
%%构建CC 
C1=zeros(Cx,m2,Bz); 
C=[C1,C]; 
C2=zeros(m1,m2+Cy,Bz); 
C=[C2;C]; 
CC1=zeros(Bx-Cx-m1,Cy+m2,Bz); 
C=[C;CC1]; 
CC2=zeros(Bx,By-Cy-m2,Bz); 
C=[C,CC2];    
C=uint8(C); 
%%隐藏 
b=B; 
b(((m1+1):(m1+Cx)),((m2+1):(m2+Cy)),1:Bz)=bitand(B(((m1+1):(m1+Cx)),((m2+1):(m2+Cy)),1:Bz),240); 
c=bitshift(bitand(C,240),-4); 
D=bitor(b,c); 
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:10000 
    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')