Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

An question about cesar's encryption

Name: Anonymous 2013-10-24 16:40

I'm doing some tests about encryption and I'm trying this one.
It's a small code and I'm having a little issue using the ASCII table.
I want to don't appear this strange chars.
http://puu.sh/4Yx30.png
What should i change?
Here's the code.

########################################################
#include <stdio.h>
#include <string.h>
#define TM 127
int main ()
{
char user [TM], userc[TM];
char pass [TM], passc[TM];
int key,len,tmax,ini,i;
tmax=125;
ini=40;

printf("Type a key: ");
scanf("%d", &key);

printf ("Type the user: \n");
scanf ("%s", &user);
len=strlen(user);

if (len<100){
    for (i=0;i<len;i++){
        if (user[i]+key>tmax){
        userc[i]=user[i]+key-ini;
        }
        else{
        userc[i]=user[i]+key;
        }
    }
//encrypted
printf("user: %s\n",userc);
}
system ("PAUSE");
return 0;
}

######################################

Name: Anonymous 2013-10-26 1:15


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List