1. Dawud Beale

    Thread Starter Member

    Feb 10, 2012
    275
    7
    Hi I am looking to make a ceasar cipher on a micro controller and wondered if anyone knew of any guides for using a PIC or some advice on how to go about doing it? Any reading material will be much appreciated. So far all I have is this to go on lol:

    http://en.wikipedia.org/wiki/Caesar_cipher

    I will post up progress here and any questions that I have. If anyone has some good reading material to start me off it would be great. Many thanks
     
  2. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    This seems so trivial I wonder if I'm understanding what the problem is. All you do is when a letter comes in, you add or subtract some constant to its ASCII value (with a test for wrapping past A or Z) and there's the result. It would be interesting to have a modern Caesar cipher based on the entire ASCII table--that would have impressed the Romans. (This "zero" you keep mentioning--what is that, please?)
     
  3. Dawud Beale

    Thread Starter Member

    Feb 10, 2012
    275
    7
    A cipher doesn't only mean zero, it also means a code or message:

    "
    cipher1
    ˈsʌɪfə/
    noun

    noun: cipher; plural noun: ciphers; noun: cypher; plural noun: cyphers
    1. 1.
      a secret or disguised way of writing; a code.
      "he wrote cryptic notes in a cipher"
      synonyms:code, secret writing; More coded message, cryptograph, cryptogram
      "the information may be given in cipher"



      • something written in a code.
        "he came across ciphers written on parchment and concealed in a hollow altar pillar"
        synonyms:code, secret writing; More coded message, cryptograph, cryptogram
        "the information may be given in cipher"




      • a key to a code.


    2. 2.
      dated
      a zero; a figure 0.
      synonyms:zero, nought, nil, 0; More archaicnaught
      "a row of ciphers"



      • a person of no importance, especially one who does the bidding of others and seems to have no will of their own.
        "journalists are not mere interchangeable ciphers in the propaganda battle"
        synonyms:nobody, nonentity, nothing, non-person, unimportant person, person of no account More "he has spent most of his working life as a cipher"
    "
     
  4. Dawud Beale

    Thread Starter Member

    Feb 10, 2012
    275
    7
    In terms of what I am unclear on, well firstly I wasn't sure how to interface the PIC to the PC via some form of terminal, so that I could send a letter to be encrypted or decrypted.

    Also how can I have a "setting" so that I can show that I wish to encrypt or decrypt the letter, without changing something in the code itself?

    And I wasn't sure how to alter the ASCII value of a letter or make a loop at Z.
     
  5. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I don't think you got my little joke. The point was discussing anything about mathematics with someone from ancient Rome would be difficult because they didn't have zero in their numerical system.

    As for the code (code which implements a cipher, hmmm) it might be something like this (for capital letters only, anything else is unchanged)

    Code ( (Unknown Language)):
    1.  
    2. unsigned char caesarize(unsigned char in_char, unsigned char modifier)
    3. {
    4.   unsigned char out_char;
    5.  
    6.   if ((in_char >= 'A') && (in_char <= 'Z'))
    7.   {
    8.     out_char = in_char + modifier;
    9.     if (out_char > 'Z')
    10.       return(out_char - 26);
    11.     else if (out_char < 'A')
    12.       return(out_char + 26);
    13.     else
    14.       return(out_char);
    15.   }
    16.   return(in_char);
    17. }
    18.  
     
  6. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,399
    497
    I am pretty sure Microchip, the manufacturer, has provided documents on how to connect PIC to PC. All you have to do is actually read it. But before you can do that, you need to pick the PIC.

    There are probably a few HOWTO on youtube as well.
     
  7. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Sure they did, they used a horizontal line (hyphen char?) for numerical entries where there was no number, like if someone on the list had no goods to tax that day. It just wasn't an official "zero" part of the numerical system. But perfectly functional as a zero, just as it still is today. :)
     
  8. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I suppose there's no room for argument when a real Roman shows up.
     
    tshuck and MrChips like this.
  9. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Smartie pants. ;)

    I often leave the history channel (or other documentary channel) running in the background when working.