Skip to content

Commit 2c614bf

Browse files
author
Mykolas Krupauskas
committed
start adding solution crack
1 parent ca43564 commit 2c614bf

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

chapter2/crack.c

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
#include <stdio.h>
22
#include <cs50.h>
3+
#define _XOPEN_SOURCE
4+
#include <unistd.h>
35

4-
int main(int argc, char **argv)
6+
int main (int argc, char **argv)
57
{
6-
// There must be two arguments
78
if (argc != 2)
89
{
9-
printf("No key provided");
10+
printf("You must provide a hash");
1011
return 1;
1112
}
12-
}
13+
14+
char salt[3];
15+
salt[0] = argv[1][0];
16+
salt[1] = argv[1][1];
17+
salt[2] = '\0'
18+
19+
char pass[4];
20+
char *characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
21+
for (int i = 0; i < 4; i++)
22+
{
23+
for (int j = 0; j < 52; j++)
24+
{
25+
26+
for (int k = 0; k < 52; k++)
27+
{
28+
29+
for (int l = 0; l < 52; l++)
30+
{
31+
32+
for (int j = 0; j < 52; j++)
33+
{
34+
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)