
Need help with program.
The program is very sloppy, but i know whats going on with it, anyway.. this is my first post so i dont know what all i need to do, like if i need to paste my code in here or whatever. But im making a vigenere decypher, that figures out the keylength and key. So far ive shifted the cipher, our teacher want us to use chisquared, but if we cant figure out how to use it, to use another way. Anyway i couldnt figure out how to use chi squared or dot product rule. I dont want the program wrote for me just help on it. Thanks
edit:: i gues i should have posted my question in here. Anyway my question is, is if anyone can help me on figuring out how to use chi squared of on the dot product rule

Well, the dot product method is explained pretty well here.
Have you managed to write your program to find the (likely) key length yet? That would seem to be the first logical step.

yes, i have that is what the shifts were for, i believe thtats what i undersdtood from the vigenere, the key length i believe is 9.
and thanks for the website the only problem i have is that the cipher is small and im not quite sure how to run a loop? maybe to check to see if the letters are the same. and it seems like the for loop i run just repeats itself and only checks 1,10,19th letters over and over
sorry if the code comes out sloppy, its my first time to post this
Code:
for (int q=0; q<28; q++)
{
for (int p=q; p<28; p++)
{
fi=0;
ca++;
for (int x=p+9; x<28; x++)
{
for (i=p+18; i<28; i++)
{
if ((a[x]==a[p])(a[p]==a[i])(a[x]==a[p]))
{
d[ca]=fi+1;
}
break;
}
break;
}
}
}
i also wanted to know if i understood this correctly what i do is check the frequencey of the 1,10,19th letters and divide them by whatever the total number is then make another table correct?