crypt.c
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:47:59 +0200
changeset 29 7abf6146898e
parent 27 81a574d60c15
child 32 9b56360ec64e
permissions -rw-r--r--
indent -bad changed to -nbad: See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=485764 committer: Markus Bröker <mbroeker@largo.homelinux.org>

/**
 * test/demos/crypt.c
 * Copyright (C) 2008 Markus Broeker
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main (int argc, char **argv)
{
    char *data;

    int i;

    if (argc != 2) {
        printf ("Usage: %s <str>\n", argv[0]);
        return EXIT_SUCCESS;
    }

    /*
     * Its already allocated
     */
    data = argv[1];

    for (i = 0; data[i]; i++)
        data[i] = data[i] + 1;

    printf ("EnCrypted Data: %s\n", data);

    for (i = 0; data[i]; i++)
        data[i] = data[i] - 1;

    printf ("DeCrypted Data: %s\n", data);

    return EXIT_SUCCESS;
}