All Questions
12 questions
1
vote
1
answer
229
views
Key looping in Vigenere
I've reached the final step of Vigenere, but I don't really understand how do I loop the key over plaintext. This is the shift function I've created:
int shift(char c)
{
if(isalpha(c))
{
...
0
votes
1
answer
46
views
Pset 2 Vigenere
For capital letters the key seems to be behind my -6. Such that A is -6 and F is zero. :(
0
votes
1
answer
50
views
vigenere problem with key, the program sees the key as only one number
When I run my code with the key it ciphers strangely:
$ ./vigenere ftskfpg
plaintext: aaaaaaa
ciphertext: ggggggg
I don't really understand why it does it, I made a loop for a key and for the ...
0
votes
1
answer
47
views
Vigenere working unless there's an 'a' in the key. Please help!
I've been at this for 2 days now and am completely stumped at this point. Absent of an 'a' (or 'A') in the key, the program works exactly as intended. If an 'a' is included in the key, however, the ...
0
votes
1
answer
172
views
cs50 pset2/vigenere - code doesn't work if text and key differ upper/lower case
I Don't know how to make code work if key is lowercase and text uppercase and vice-versa. Before I considered case sensitivity my code would work except for a few letters. Now it wont output full ...
0
votes
2
answers
118
views
cs50/pset2/vigenere why can't my code handle a key world of Hax0r2? code works otherwise
My code works properly, except that it doesn't reject numeric key. I try using an if statement to validate input key as follow:
int main (int argc, string argv[])
{
if((argc != 2) || (isalnum(...
0
votes
2
answers
105
views
PSET 2 Vigenere - problem
My code works with a Key of BBB and the letters AAA and loops properly and skips spaces, numbers, punctuation but fails the tests. With a key of baz, it turns world say hello to xpsme, tbz ifmmp and ...
0
votes
1
answer
44
views
vigenere set key values not working
This is the code I am using to change the string key into their respective shift values. For some reason as I have put a printf to test this, it outputs some weird strings of numbers.
int k[strlen(c)]...
0
votes
1
answer
96
views
Vigenere - how to apply local variable in key to secret message
I've been a bit stuck in trying to solve this problem involving changing the key from one letter to the next. I haven't gotten to wrap around the key yet. I think I know what the problem is but need ...
0
votes
1
answer
213
views
pset2 Vigenere: Problems Applying Key & Case
for (int i = 0, n = strlen(p); i < n; i++)
{
if (isalpha(p[i]))
{
if (isupper(p[i]))
{
char stringshifttext = ((((p[i] - 'A') + (k[i % strlen(k)] - 'A')) % 26) ...
1
vote
1
answer
487
views
Vigenere key counts spaces in progression
Whenever I type plaintext into my vigenere cipher, it moves forward one letter when it encounters spaces or punctuation, even though the key does not affect those characters. How can I prevent this? ...
0
votes
2
answers
50
views
Incorrect results when the key has fewer letters than GetString
The title says it all, I can't get my key to repeat itself correctly after one repetition. For example, if my key is 3 letters and GetString is 6, then the last3 letters of GetString will be ...