ROT13.c
#include#include #include char *Encrypt(char *Data) { int i; int Len = strlen(Data); if((Data == NULL) || (Len <= 0)) return (char *)"Error Data is NULL!"; for(i = 0; i <= Len; i++) { if(((int)toupper((int)Data[i]) >= 65) && ((int)toupper((int)Data[i]) <= 90)) { Data[i] = (((toupper((int)Data[i])) + 13) % 90); if(Data[i] < 65) Data[i] += 65; } } return Data; } int main(int argc, char **argv[]) { char EncrText[1000]; sprintf(EncrText, "This is a test of ROT13 Encryption"); printf("\nThe ROT13 Cypher:\n\tThis cypher is very simple.\n\tIt simply rotates the charachters of the plaintext over 13 places.\n\n"); printf("\nPlain Text: %s\n\n", EncrText); printf("Cypher Text: %s\n", Encrypt(EncrText)); return 0; }