crypt.c
changeset 0 af501b0c1716
child 8 96d16dfe787a
equal deleted inserted replaced
-1:000000000000 0:af501b0c1716
       
     1 /**
       
     2  *     $Id: crypt.c,v 1.1.1.1 2008-04-28 17:32:53 mbroeker Exp $
       
     3  * $Source: /development/c/demos/crypt.c,v $
       
     4  *
       
     5  */
       
     6 
       
     7 #include <stdio.h>
       
     8 #include <stdlib.h>
       
     9 #include <string.h>
       
    10 
       
    11 int main (int argc, char **argv)
       
    12 {
       
    13     char *data;
       
    14     int i;
       
    15 
       
    16     if (argc != 2) {
       
    17         printf ("Usage: %s <str>\n", argv[0]);
       
    18         return EXIT_SUCCESS;
       
    19     }
       
    20 
       
    21     /*
       
    22      * Its already allocated
       
    23      */
       
    24     data = argv[1];
       
    25 
       
    26     for (i = 0; data[i]; i++)
       
    27         data[i] = data[i] + 1;
       
    28 
       
    29     printf ("EnCrypted Data: %s\n", data);
       
    30 
       
    31     for (i = 0; data[i]; i++)
       
    32         data[i] = data[i] - 1;
       
    33 
       
    34     printf ("DeCrypted Data: %s\n", data);
       
    35 
       
    36     return 0;
       
    37 }