Thread: Put this algorithm into code

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    So the idea of this is fine, I guess.

    > char key[100];
    Here you declare key as an array and it's empty.

    > k = 'A' + (c - key);
    Then you start using the array name of the key to decrypt

    > key[c] = k;
    And also store the plaintext somewhere in the key?

    And you do similar things when you encrypt:

    > k = key + (c + key - 2 * 'A');

    In pretty much all of these cases, you probably only intended to use part of the key in a loop, which right now, it doesn't look like you're attempting to do at all.

    Also you really need to separate plaintext, key, and ciphertext. Each of these things need their own array, perhaps even of the same size (to start with). You cannot store plaintext in the key array without overwriting part of the key.

  2. #2
    Registered User
    Join Date
    Jun 2020
    Posts
    9
    Is this how an autokey cipher would work or is there an easier way.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sudoku how to include algorithm into this code?
    By maestorm in forum C Programming
    Replies: 8
    Last Post: 05-22-2014, 04:05 AM
  2. algorithm to code.
    By mast3124mind in forum C Programming
    Replies: 6
    Last Post: 03-27-2013, 07:51 PM
  3. Algorithm code problem
    By Djur0 in forum C Programming
    Replies: 11
    Last Post: 01-22-2012, 02:11 PM
  4. Understanding Genetic Algorithm Code!!
    By L3munoz in forum C Programming
    Replies: 2
    Last Post: 10-25-2010, 06:53 AM
  5. need source code for Cohen sutherland algorithm
    By specks5317 in forum C++ Programming
    Replies: 1
    Last Post: 10-17-2002, 08:24 PM

Tags for this Thread