Hot answers tagged

4 votes
Accepted

pset2: Crack takes a lot of time

Answered by an instructor on reddit. here:https://www.reddit.com/r/cs50/comments/9o3eg8/pset2_crack_is_taking_a_lot_of_time/
user avatar
2 votes

PSET2, crack.c Did this problem fall out of the sky from week 115? Am I overthinking this?

Crack is a 'more comfortable' problem, so it assumes that you have programming experience and that you have a knowledge of arrays, strings, loops, etc. If you don't consider yourself in the 'more ...
user avatar
  • 18.4k
1 vote
Accepted

CS50 2017 crack.c not working properly

Your code doesn't wrong actually but your assuming that passwords have four characters only because of this wrong assumption some of hashes doesn't return anything. for example try this hash: ...
user avatar
1 vote

PSET2: Can't figure out what's wrong with my crack.c code?

The problem is that you have essentially created an infinite loop. Initially when your while code starts, your first for loop runs, then your second, then third and then fourth but they never check ...
user avatar
1 vote
Accepted

pset2 crack.c, competence question

The 'more comfortable' problems seem to be geared toward people who have at least a little prior experience in programming. The entire problem can be solved with arrays and loops (in under 100 lines ...
user avatar
1 vote
Accepted

strcmp not evaluating as expected

It looks like strcmp() isn't being used as it should. ( I don't understand why the result of strcmp is being checked for > 1. ) The strcmp(s1, s2) function compares two strings, char by char and ...
user avatar
  • 64.2k
1 vote
Accepted

cs50 pset2- crack.c gives me a segmentation fault

In C, strings are arrays of char. You assign a string to a char variable, maybe you meant '\0' (string terminator) instead of "" (empty string). You cannot add them to concatenate, you'd have to ...
user avatar
  • 20.7k
1 vote

How to generate passwords in Crack Pset 2?

Yes, you can have password that are mixed case. I believe you already know how to join strings or individual chars together, for example from exercises where we learn to printf "Hello" + name together....
user avatar
1 vote
Accepted

Question about Crack in PSET2

The salt must be saved together with the hash, so that we can reproduce the result. A password check function would hash a password using the same salt and compare the results. The salt here are the ...
user avatar
  • 20.7k
1 vote
Accepted

crack.c: No response 😒

I'd remove the space from the pool of valid password characters, and try again. Maybe you saw a less than 5 character password with some space character in front. You don't have a break; after done = ...
user avatar
  • 20.7k
1 vote
Accepted

crack.c: UndefinedBehaviorSanitizer:DEADLYSIGNAL --SOLVED--

The UndefinedBehaviorSanitizer (aka UBSan) relates to execution-time bugs caused by various kinds of undefined programme behaviour. For instance, Using misaligned or null pointer, Signed integer ...
user avatar
1 vote
Accepted

pset2 crack: Takes too long

Keep in mind that a "string" in C is simply a character array that is null terminated. As such, your salt variable is not a string, nor is your temp variable in all cases. As a consequence, when you ...
user avatar
  • 18.4k
1 vote

pset2 crack: Takes too long

This program takes a notoriously long time to run. It's also an exercise in making code more efficient. Also, at this point, you should start being able to answer questions on your own, like this one: ...
user avatar
  • 64.2k
1 vote
Accepted

my crack.c actually works, but doesnt give away the key! Pset2

What you're really trying to say is that it compiles, but it doesn't work. There's a major problem with the logic. I won't spoil it for you, but I'll point you at it. Add a print statement to print ...
user avatar
  • 64.2k
1 vote
Accepted

Basic use of crypt in crack.c? (Hash "ROLF")

Unfortunately, there was a typo in the spec. The first example given was correct: ./crack 50fkUxYHbnXGw rofl but when repeated later in the spec, it showed ROFL in error. This has been ...
user avatar
  • 18.4k
1 vote
Accepted

crack.c: error: implicit declaration of function 'crypt' is invalid in C99

The spec is perfectly correct. More than likely, you don't have #define _XOPEN_SOURCE #include <unistd.h> At the very top of your program (ie, before any other #includes). If you move that ...
user avatar
  • 18.4k

Only top scored, non community-wiki answers of a minimum length are eligible