Questions tagged [vigenere]
Vigenere Cipher, one of the assignments in Problem Set 2. It's like Caesar Cipher, but with a twist.
497
questions
3
votes
1
answer
599
views
Pset2 Vigenere 'szz' instead of 'rby'
I fail one test case, and just the one portion of it.
Expecting the following on standard out — xoqmd, rby gflkp!\n ... but received the following on standard out instead — xoqmd, szz gflkp!
rby =\...
2
votes
1
answer
353
views
Why does my vigenere not pass check50 although it gives the correct output?
When checking vigenere.c with check50, I get the following
:) vigenere.c exists
:) vigenere.c compiles
:( encrypts "a" as "a" using "a" as keyword
\ expected output, but not "a"
:( encrypts "world,...
2
votes
1
answer
4k
views
pset2 vigenere error "incompatible integer to pointer conversion"
This is the error I get:
vigenere.c:34:34: error: incompatible integer to pointer
conversion passing 'char' to parameter of type
'const char *'; take the address with &
[-Werror,-Wint-...
2
votes
1
answer
286
views
Expression result unused in Vigenere
I am getting this error: expression result unused and I don't know what that means. I use the code it's pointing to (green underline), just like I do in my Caesar cipher which works:
The other posts ...
2
votes
1
answer
623
views
Failing one test case with check50 on pset2 - encrypts "say" to "szz" instead of "rby"
encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword
# Checks
0 Running... clang -o vigenere vigenere.c -lcs50 -lm. ✔
1 Expecting an exit code of 0. ✔
2 Running... ...
2
votes
1
answer
137
views
Don't understand Vigenere cipher?
I don't understand why we could attack Vigenere cipher when we know the key's length? Can anyone give me a hint? Thank you very much?
1
vote
2
answers
770
views
pset2 (vigenere) - Check50 error problems
I'm stuck on an issue with my code. After completing my code and making sure it works as should, I run check50 and this is what I get;
jharvard@appliance (~/Dropbox/pset2): check50 2014/x/pset2/...
1
vote
1
answer
66
views
vigenere sometimes prints extra characters at the end of ciphertext in an unpredictable pattern
Check50 yields 2 error messages (the rest is correct):
:( encrypts "a" as "a" using "a" as keyword
output not valid ASCII text
:( encrypts "world!$?" as "xoqmd!$?" using "baz" as keyword
output not ...
1
vote
4
answers
156
views
Cs50's vigerene encrypting problem
My code complies well but encrypts the text in the wrong way.Could someone help me find the problem?
any help will be appreciated
here is my code:
#include <stdio.h>
#include <cs50.h>
#...
1
vote
1
answer
3k
views
Vigenere cipher coding drama!
your help is appreciated and please feel free to critique my coding approach. My concern is, not only that the code isn't working, but that I maybe complicating this more than it needs to be.
Working ...
1
vote
4
answers
801
views
Vigenere Cipher Doesn't Work Properly
I have been trying for way too long to make my Vigenere cipher work, but now I am so confused I don't even know what I am doing. I need some guidance in what it is that I am doing wrong. When I ran ...
1
vote
1
answer
482
views
cs50/pset2/vigenere: Code works but check50 rejects 2 item
check50 message: https://cs50.me/checks/c053757544cd74cafb77554759754b8ee4ee37a8
The code doesn't encrypts "a" as "a" using "a" as keyword. It adds a wierd character in the end and I don't know why. ...
1
vote
2
answers
131
views
vigenere.c key just wraps around ... if there is space in plain text it seems to ignore that key and move on to next
int main(int argc, string argv[])
{
string k;
k = argv[1];
if(argc == 2)
{
for(int i=0,j=strlen(k); i<j; i++)
{
if( isdigit(k[i]))
{
...
1
vote
1
answer
141
views
Vigenere -Isalpha only checking first char of key
When checking the command line argument in Vigenere.c to see if it contains any non-alphabetic characters, I can't get my for loop to iterate past the first character. I have read all of the posts on ...
1
vote
1
answer
97
views
Pset2- Vigenere: returning error on BaRFoo only
I am trying to complete vigenere's cipher by the end of tonight before I am shortly without internet. I have been working on this one error for several hours and cannot figure out how to fix it. The ...
1
vote
1
answer
278
views
vigenere output "incompatible pointer types"
I'm trying to solve pset2 vigenere, but I'm having some troubles. I'm using two functions to adapt the key to the text and then to apply the cipher. When I run the last function, I can't get any ...
1
vote
1
answer
135
views
Pset2 - Vigenere fails check50 with "expected exit code 0, not 1"
I'm at my wits' end. My code for vigenere compiles fine using make vigenere within CS50 IDE. However, when I run check50, I get this:
:) vigenere.c exists.
:( vigenere.c compiles.
expected exit ...
1
vote
1
answer
797
views
why am i getting "can't check until a frown turns upside down"?
as shown why am i getting this.Please just give me a clue or prompt something.I'll fix it by myself.
1
vote
1
answer
10k
views
C: Vigenere - incompatible pointer types passing 'char **' to parameter of type 'const char *
I'm trying to iterate repeatedly over key (a word) which the user inputs on the command line. This keyword is used to encipher a word which the user inputs when prompted by the word 'plaintext'. I ...
1
vote
2
answers
103
views
CS50 PSET2 VIGENERE problem with key lenght in loop
I have a problem printing the word "world". My code is the following (EDIT):
#include <cs50.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h&...
1
vote
2
answers
105
views
Finished vigenere, but it fails to work as it should
*UPDATE:
Actually, I can't understand a thing now. Let's take an example from check50. Our program should encrypt "world, say hello!" with a keyword "baz". It expects "xoqmd, rby gflkp!" as a correct ...
1
vote
2
answers
192
views
CS50 vigenere.c works for lower but not upper case letters
The following is my code, I'm not sure where I went wrong with my code, but when I run it, it seems to work for lower case letters but not uppercase. This isn't the full code, due to academic honesty, ...
1
vote
1
answer
168
views
Can't get the 'z' using % 26 on my Vigenère Cypher
I've been trying for a while to get this right but I guess I can't do the math.
I'm using this line to encrypt each character for the Vigenères Cypher:
int letter = ((p(i) - 96) + (k[j] - 97) % 26 + ...
1
vote
2
answers
58
views
PSET 2 Vigenere - only getting symbols as output
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 ...
1
vote
1
answer
205
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))
{
...
1
vote
1
answer
47
views
Pset2 - Vigenere - Encypts all variations of "barfoo" as "ca\..." (no case issues)
This is my first question on Stack Exchange. I had a few different issues with this problem but I felt I'd finally sorted them out until I ran into this. I've been working for a number of hours today ...
1
vote
1
answer
132
views
Help with understanding the wrap-around method for Vigenere Pset
I'm having troubles with implementing the wrap around method needed for passing this problem. As you will see, my code so far encypher a number of plaintext letters as equal as the number of the "key" ...
1
vote
2
answers
90
views
pset2 vigenere problems
I am kind of stuck with my Vigenere Code so far... and i really feel like don´t know how to work it out from here!
Any kind of advice is much appreciated, or i might be stuck here forever :(
#include ...
1
vote
1
answer
138
views
CS50 Vigenere expected output, not a prompt for input
when I check my program, there is the "expected output, not a prompt for input" error for every input they are trying to check.
however, when I am testing it, all inputs seem to be exactly the same as ...
1
vote
1
answer
61
views
I get "/opt/sandbox50/bin/run.sh: line 31: 304..." when I try to include j-- in my loop
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main (int argc, string argv[])
{
//checks if argc is 2
if (...
1
vote
1
answer
85
views
Sometimes the vigenere cipher went wrong but i can't figure out why~please help!
it compile like this:
~/workspace/pset2/ $ check50 2015.fall.pset2.vigenere vigenere.c
:) vigenere.c exists
:) vigenere.c compiles
:) encrypts "a" as "a" using "a" as keyword
:( encrypts "world, ...
1
vote
1
answer
94
views
Vigenere corect encryption with weird letters at the end
so here is my Vigenere code
do //Key validation
{
if (argc != 2)
{
printf("You must enter key!");
return 1;
}
else
{
for (int i = 0; i < strlen(argv[...
1
vote
1
answer
484
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? ...
1
vote
2
answers
1k
views
pset2 , vigenere. ASCII math struggle
something weird is going on with my code. I get the first word ("Meet" with key "bacon") right, but after that, things are getting really hairy.
here is my code. I would really apreciate any help, I'...
1
vote
1
answer
297
views
PSET2 Vigenere segmentation fault
I am getting nuts trying to figure out why my vigenere application gives a "Segmentation fault (core dumped)" every time I try to run it (my code is there).
Can someone point out some mistakes that ...
1
vote
1
answer
137
views
pset 2, Vigenere: How do I stop the keyword from looping if there is a "nonalpha" in the sentence?
My problem is that while the program loops through the sentence to be encrypted, my keyword (i.e.) bacon, doesn't stop looping when there is i.e. a space in the sentence.
So instead of
Sentence: ...
1
vote
1
answer
121
views
Having problem in checking keyword of vigenere when it has &, (, or )
If the keyword includes &, (, or ), the program does not yell at the user for re-input, instead, comes back with the following messages for various inputs.
Please note v6 is a vigenere trial ...
1
vote
1
answer
698
views
pset2 vigenere doesn't work check50 with BaRFoo
I finished my vigenere and it works good with all the parameters but when I go through check50 with BaZ keyword, check50 give this answer
jharvard@appliance (~/Dropbox/CS50/pset2): ./vigenere BaZ
...
1
vote
1
answer
287
views
Trouble verifying the keyword in vigenere
I'm having trouble verifying the argv[1] keyword along the guidelines of the assignment.
I've tried to implement an if ... else statement the checks if argc is 2 and argv[1] is alpha, if so, run ...
1
vote
1
answer
482
views
Pset2 Vigenere. Works for lower and uppercase letters separately, but not for whole code
I've worked on (and dreamed about) Vigenere for a few days now, and I'm almost there. I think! If I try out my code separately for lower and uppercase letters (by commenting out the irrelevant part), ...
1
vote
1
answer
310
views
pset2 vigenere; isalpha is accepting numbers in argv[1]
I'm using the construct
if(isalpha(argv[1][i]) == 0)
to determine if the chars are alphabetical in argv[1] with a for loop. The program compiles, however, isalpha is not working. If I enter, for ...
1
vote
1
answer
72
views
Vigenere almost working, but fails somewhere
I give up, I can't make it work. Please kindly point me to a line where I make mistake.
// input validation
if (argc != 2)
{
printf("Invalid argument. Please, try again\n");
return 1;
}
...
1
vote
1
answer
122
views
Vigenere print error
I've got my code to cycle through the plaintext index p and the key index. However I keep getting an error when I am printing and can't figure it out. When I use the test spec using bacon as the key
...
1
vote
0
answers
75
views
Vigenere - Incorrect output
I have made a mistake in the equation for the new output.
char newmsg = (((plain[i] - 97 + key[j % klength]) % 26) + 97);
Can someone please give me a clue as to what I did wrong here? ...
1
vote
1
answer
738
views
Vigenere fails check50 test "encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword"
I successfully completed the Vigenere program and I was recently testing it with Check50. My problem is that there is only one test that fails, and I don't know why:
:( encrypts "BaRFoo" as "CaQGon" ...
0
votes
3
answers
22k
views
How to Wrap Around Array Indexes?
I have the Vigenere encryption portion working properly, but can't seem to figure out how to wrap around argv[1] indexes.
My first for loop declared two ints, i and j, and incremented each int with ...
0
votes
1
answer
2k
views
How to Handle "rejects "Hax0r2" as keyword" in Vigenere?
So I made my Vigenere program and it passes all the tests except for the last one about not accepting keys with non-alphas. Now, I have a check in my program to stop this, and when it detects a non-...
0
votes
1
answer
1k
views
Incompatible pointer types error vignere
Can anyone explain this error?
Here is my code:
int main(int argc, string argv[])
{
// code snipped
int c = strlen(argv);
// code snipped
Here is the error:
vig.c:15:20: error: incompatible ...
0
votes
1
answer
281
views
extra characters in Vigenere pset2 2016
I am working on the Vigenere pset and seem to be getting the correct encryption but the output has nonsense characters added to it.
For example:
:( encrypts "a" as "a" using "a" as keyword
\ ...
0
votes
1
answer
528
views
PSET 2 - Vigenere: How do I wrap around my key to the plaintext?
Having some trouble with pset2 vigenere. Here is my code:
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
...