So far in Vigenere i've gotten to the point with a single character key, and when I tried to test it, everything works except my output is entirely ����
.
Here is my code for the shift function and where it actually applies it:
int shift(char c)
{
int k = c;
return k;
}
for(int i = 0; i < strlen(s);i++) // ensures the argument is alpha
{
if(isalpha(s[i])==false)
{
printf("Error: only alphabetic arguments allowed\n");
return 1;
}
int key = shift(argv[1][0]);
printf("plaintext: %s\n", input);
printf("ciphertext: ");
for (int c = 0, n = strlen(input); c < n; c++)
{
printf("%c", input[c]+key);
}
printf("\n");
}
Here's the actual terminal output:
$ ./vigenere h
Message to be encrypted: hello
plaintext: hello
ciphertext: �����