Questions tagged [key]
The key tag has no usage guidance.
18 questions
0
votes
1
answer
63
views
Print keys of CSV files in DNA pset6
I want to see what the keys of the reader dictionary are so I use the print(key) function. The result is all the lines of the dictionary. Why is that?
import csv
from sys import argv, exit
# Check if ...
0
votes
1
answer
480
views
PSet 2: Caesar, validating key
I'm struggling with the output to the "Validating Caesar's Key" part of PSet 2. First-timer here, like many, and appreciative of any insight. When I compile and then run this program with "./caesar 2",...
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
331
views
PSET 2 Caesar: Help getting key from user (one line)
I am currently on CS50x’s PSET2, Caesar, trying to get a key from the user (the first step pretty much). I need to get the key from the user. I understand that it will be a string stored in argv2 and ...
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
1
answer
110
views
pset7: portfolio table gives error
I'm following the instructions in pset7's page, and I have to give users free shares, by inserting a new table in portfolios. However, i get this error:
#1062 - Duplicate entry '1' for key 'PRIMARY'
...
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 ...
0
votes
1
answer
75
views
How can I display "< key>" on the same line if argc != 2?
How can I display "< key>" on the same line if argc != 2?
Example:
check50 2014.fall.pset2.caesar caesar.c
0
votes
1
answer
71
views
compare value to key (dropoff)
For dropoff() in my pset8 code I'm stuck at the following line
//find house in range
for (var i in HOUSES)
if in range
// iterate over seats
for (var j in shuttle....