简单加密解密


void encrypt(char *password) {

	int x = strlen(password);

	char t[strlen(password)];
	strcpy(t, password);
	int i;
	
	for(i=0; i<strlen(password); i++) {
        char cur = t[i];
        	if(isalpha(cur)) {
            		t[i] = cur +1;
		}
    	}
	printf("%s\n",t);


	for(i=0; i<strlen(password); i++) {
        	char c = t[i];
        	if(isalpha(c)) {
            		t[i] = c - 1;
        	}
    }
    printf("the decrypted message is: %s\n", t);
}


int main() {
	char msg[] = "root";
	printf("%s\n", msg);
	encrypt(msg);
}



评论