0

Hy guys , i have almost finished with vigenere.c and when i did several tests it was doing well , but when ai tried to encrypt "Meet me at the park at eleven am" using as a keyword "bacon" that's the output :

  • output i get :Negh zR av huR pcfp Nt gzrIep oz
  • correct ouput:Negh zf av huf pcfx bt gzrwep oz

what i noticed is that it's the output except the fifth elements wich is the keyword length Any thoughts ?

[code removed]

1
  • Can you post your encryption code here. May be then we can help you out better?? – HKH Jun 28 '14 at 18:57
1

Your check

if(j >= length_k  )
{
    j= j%length_k;
}

Just move this check to right after j++. like this

 j++;
 if(j >= length_k  )
 {
    j= j%length_k;
 }

That should solve your problem.

2
  • Thanks man , it was driving me crazy ! – issamouu Jun 28 '14 at 22:03
  • @issamouu You are welcome – HKH Jun 28 '14 at 22:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .