gusucode.com > cryptography_matlab_codes > cryptography_matlab_codes/uncrypto.m

    function cract=uncrypto(txt)

%fr=frequency(txt);
temp=zeros(10,1);
%shuzu=zeros(5,1);
for k=1:10
    temp(k)=coinc(txt,k);
end;
max1=max(temp);
count=0;
max11=0;
for k=1:10
    count=count+1;
    if (max1==temp(k))
        max11=count;       
    end
end
for k=1:max11
    t1=choose(txt,max11,k);
    frequency(t1);
    t2=vigvec(txt,max11,k);
    t3=corr(t2);
    maxco=max(t3);
    %kk=sizeof(t3);
    count=0;
    
    for k1=1:26
        count=count+1;
        if (maxco==t3(k1))
            shuzu(k)=count-1;
            
        end
    end
end
output=vigenere(txt,-shuzu);
disp(output);