A program to encrypt or decrypt text using vigenere cipher technique

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 15802 Views - Last Post: 21 November 2011 - 02:32 AM Rate Topic: -----

#16 AmitTheInfinity   User is offline

  • C Surfing ∞
  • member icon

Reputation: 119
  • View blog
  • Posts: 1,565
  • Joined: 25-January 07

Re: A program to encrypt or decrypt text using vigenere cipher technique

Posted 27 October 2010 - 01:30 AM

@mocoyombi : Well I am printing characters as I decrypt them, if you want you can store them in character array one by one and once you come out of that for loop you can print them using puts or printf with "%s". And about that 65 or 64 or something like that... as I told you it's just something like shift of origin for me. see If I subtract 'A' from 'A' or if I subtract ('A' -65) from ('A' - 65) or ('A' - 64) from ('A' - 64) I am about to get the same answer. I added that factor just to add ease of calculation while debug or dry run. So while doing calculations to verify by myself I don't need to do big calculations like (72+65)%26 etc. :) I just find the index number of character and add it with the other. Even if you remove those 65 or 64 subtractions (only... not from addition) still it won't make any difference to the algorithm.
Was This Post Helpful? 0
  • +
  • -

#17 sheshjee   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 06-October 11

Re: A program to encrypt or decrypt text using vigenere cipher technique

Posted 06 October 2011 - 09:30 PM

@AmitTheInfinity: thanx for nice explanation, but i have a problem with is code. Suppose i want to encrypt "She is listening" and the key is "PASCAL" , so your code is considering the SPACE also in b/w she & is and is & listening. rather i want to ignore that space. please help me to short out this problem.
Was This Post Helpful? 0
  • +
  • -

#18 AmitTheInfinity   User is offline

  • C Surfing ∞
  • member icon

Reputation: 119
  • View blog
  • Posts: 1,565
  • Joined: 25-January 07

Re: A program to encrypt or decrypt text using vigenere cipher technique

Posted 21 November 2011 - 02:32 AM

@sheshjee : Sorry for this extremely late reply. I was away from DIC for a while. About your question, well I wrote that in instructions section above, I was bit lazy to do that. :) But you can do it by writing a small code which will remove white-spaces or anything apart from alphabets. All you need to do is have a temporary array, copy alphabets from original array to this one, ignoring everything else. once you are done with it. either use the new array or clean the original one and copy this new string in to it. This is just a crude logic I came up with on the fly. Try it. May be you will find a better snippet for that in this section itself. All the best.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2