Vigenere Cipher decryption help needed

This is a discussion on Vigenere Cipher decryption help needed within the C Programming forums, part of the General Programming Boards category; problem solved...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    7

    Unhappy Vigenere Cipher decryption help needed

    problem solved
    Last edited by magic101; 02-07-2009 at 07:14 PM. Reason: none

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Code:
          value = (toupper(buff)-64)-(toupper(key_array[i])-64);
          if(value < 0){
    		  value = value * (-1);
          }
    Blue: The -64 bit evens out, doesn't it?
    Red: I think this should be "value = 26 + value" or some such.
    Assuming this was right, you could do "value = -value", which is much simpler to follow and the compiler won't make an unnecessary multiply if it isn't clued onto what you are doing (most compilers probably DO understand that you are simply changing the sign, but why write more complicated code and ALLOW the compiler the oppurtinity of making more complex code?).

    --
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    7
    thank you soooooooooo much
    26+ value worked

    thanks again

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Cipher Program
    By PunchOut in forum C Programming
    Replies: 7
    Last Post: 11-22-2008, 12:12 PM
  2. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  3. Crashing Vigenere Cipher program
    By ultrabot90 in forum C++ Programming
    Replies: 15
    Last Post: 09-21-2007, 05:41 PM
  4. About aes
    By gumit in forum C Programming
    Replies: 13
    Last Post: 10-24-2006, 03:42 PM
  5. My little Caesar cipher emulator
    By dead_cell in forum C++ Programming
    Replies: 3
    Last Post: 01-16-2004, 12:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21