<mosaic.cnfolio.com>
PROGRAM
  1. ------------------ Pseudo code ---------------------
  2.  
  3. start
  4. /*
  5.    must be 2 to 16 characters
  6.    only contain lower case characters of the alphabet
  7.    only contain letters from A to Z
  8.    no words to be duplicated
  9.    indicate the letter N to be the starting point
  10.    
  11. / start encrypting the start of the cipher key
  12.    
  13.    let the cipher key postition the letter N as the starting point and the target value
  14.    letter at N+1 is the substitution value
  15.    Then in plain text, replace both values
  16.    increase N by one and repeat
  17.    untill the cipher key ends
  18.    
  19. / input
  20.  
  21.    firstly line of input is a number indicating the length of the cipher key
  22.    then this line of input is the cipher key text
  23.    then this line of input is a number indicating the length of the plain text
  24.    finally input this line of input is the plain text to be encrypted
  25.  
  26. /  output
  27.  
  28.    the output should show the number from each step 1,2,3 and 4
  29.    must show each target value and substitution value
  30.    The encrypted text at each substitution step
  31.    
  32. */
  33.  
  34. -------------------- Main code ------------------------
  35. #include <stdio.h>
  36. #include <string.h>
  37. #include <stdlib.h>
  38. #include <ctype.h>
  39.  
  40. char shift_tbl_l[26] = "nopqrstuvwxyzabcdefghijklm";
  41. char encrypt(char inchar)
  42. {
  43.    {
  44.       return shift_tbl_l[incar-'a'];
  45.    }
  46.    return inchar;
  47. }
  48.  
  49. int main()
  50.  
  51. bool encipher(char* input. char* cipherAlphabet, char* output)
  52. {
  53.       char* plainAlpahbet = "abcdefghijklmnopqrstuvwxyz";
  54.       return cipher(input, plainAlphabet, cipherAlphabet, output);
  55. }
  56.  
  57. bool decipher(char* input. char* cipherAlphabet, char* output)
  58. {
  59.       char* plainAlpahbet = "abcdefghijklmnopqrstuvwxyz";
  60.       return cipher(input, plainAlphabet, cipherAlphabet, output);
  61. }