Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, string argv[]) {
- string hash = argv[1]; // Read from argv
- crack_password(hash);
- }
- void crack_password(char * hash) {
- printf("%dn", hash) // prints correctly.
- string * password_guess = // some functionality, hash doesn't change
- match_password(password_guess, hash);
- }
- match_password(char * password_guess, char * hash) {
- printf("%dn", hash) // prints correctly.
- char first_two_letters[2] = "";
- append(first_two_letters, hash[0]);
- printf("Hash: %sn", hash);
- append(first_two_letters, hash[1]);
- printf("%dn", first_two_letters) // prints first two letters of the hash.
- printf("%dn", hash) // hash null here.
- }
- void append(char* s, char c) {
- int len = strlen(s);
- s[len] = c;
- s[len+1] = '