www.pudn.com > hide1.rar > hide3.m, change:2004-03-04,size:1035b


function hide() 
m=input('please input the lock password:'); 
B=imread('E:\chan\mat\b.bmp','bmp'); 
imshow(B);pause;close; 
[Bx,By,Bz]=size(B); 
C=imread('E:\chan\mat\cc.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 
for i=1:Bx 
    for j=1:By 
        for k=1:Bz 
            if (i>m1)&(i<=m1+Cx)&(j>m2)&(j<=m2+Cy) 
                CC(i,j,k)=C(i-m1,j-m2,k); 
            else 
                CC(i,j,k)=uint8(0); 
            end 
        end 
    end 
end 
%%隐藏
b=bitand(B,240); 
c=bitshift(bitand(CC,240),-4); 
D=bitor(b,c); 
imshow(D);pause;close; 
imwrite(D,'E:\chan\mat\d.bmp') 
n=input('please input the unlock password:'); 
%%提取 
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); 
size(U) 
imwrite(U,'E:\chan\mat\e.bmp') 
imshow(U);pause;close; 
sprintf('ok')