2
votes
Accepted
The predefined login function does not seem to be working in finance
Try any user with the password password. All users are created with that same password.
This hashp = generate_password_hash("password") treats password as a string literal, because of the ". You ...
1
vote
Accepted
PSet5 Speller: Are we hashing the words in the dictionary into a hash table or the words of the text?
the purpose of the hash function is to calculate a hash value for a given word and return that value. Nothing more.
The table[] array (or whatever you name it) is an array of pointers to the first ...
1
vote
Accepted
PSET5 - 3 conceptual questions (debug not needed)
Q1: Is it possible? Yes, if you have software specializing in decription. Simple hash functions like encoding the first letter would be easy for systems designed to decode. Highly complex hashes? ...
1
vote
Accepted
Speller skips first word in dictionary
I'm surprised there aren't more problems! Look at the following code:
while ((ch = fgetc(d)) != EOF)
{
fscanf(d, "%s", dictword);
The while statement scans the first letter ...
1
vote
Accepted
Speller not working! What's going on?
First, since the global declarations and other code that comes at the top of the file weren't included, I've had to guess at some things to test the code.
I suspect that sumstring, used in the hash ...
1
vote
Accepted
PSet2 Crack: crypt() returning same hash
I'd say crypt works as expected, and is not the cause for your problem.
Passing z or z_val does the same thing, as arrays are passed as a pointer to their first element. Same goes for returning o or ...
1
vote
Accepted
Question about PSet 2 Crack
A couple of things, if your if condition returns 1 in case of error you don't need an else clause, this only complicates the code. In addition you should print the correct way to use the program, a ...
1
vote
pset1 always adding extra one space on each Hash row
You set height equal to four. This also sets j to four.
See how this works on the first line:
i = 0 by definition, so you print a " " every time j is above i and deduct one from j.
You can repeat ...
1
vote
Accepted
Segmentation Fault on Hashtable
new->s="";
lets new->s point to an empty string stored in a read-only area.
strcpy(new->s,val);
then tries to write to that read-only area.
You need writable memory associated to the ...
1
vote
Accepted
PSet 5 Speller Compiles, but Not Producing Output
In your load function, you are created a new_node, adding it to your linked list, and then freeing it free(new_node);. You've just thrown away your node.
You shouldn't free your nodes until you ...
1
vote
Accepted
Problems with hash function in pset5
The code will return index % HASHSIZE;, but where is index calculated? Maybe index was supposed to be hash?
If this answers your question, please click on the check mark to accept. Let's keep up on ...
1
vote
In pset5 is there a preferred place to put the hash function?
Putting actual code into a .h header file is something that should never be done. Any hash function, or any function for that matter, should be in a .c file. In this case, you should be putting your ...
1
vote
Accepted
Spell-checking segmentation fault
You're right that it is in the load function. The seg fault occurs near the end.
previous -> next = new;
The problem occurs when you are adding the first word for a given hash index to the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
hash × 22pset5 × 12
speller × 7
load × 7
hash-table × 3
pset7 × 2
c × 2
mario × 2
finance × 2
dictionary × 2
pset2-crack × 2
hash-function × 2
crypt × 2
pset2 × 1
pset1 × 1
error × 1
check × 1
unload × 1
crack × 1
string × 1
cs50x2017 × 1
register × 1
linked-list × 1
mario.less × 1
pyramid × 1