1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "aocdailies.h"
#include "aocutils.h"
void aoc201504(char *data, size_t len) {
(void)len; // unused argument
unsigned extra = 1;
char longkey[128];
for (;;) {
sprintf(longkey, "%s%u", data, extra);
//md5(longkey);
if (1) break;
extra++;
}
printf("Follow your key with %u to obtain five zeroes\n", extra);
}
struct House {
int row, col;
};
void aoc201503(char *data, size_t len) {
|
|
<
>
>
|
|
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "aocdailies.h"
#include "aocutils.h"
void aoc201504(char *data, size_t len) {
data[--len] = 0; // remove newline, adjust `len`
char longkey[128];
unsigned extra = 1;
for (;;) {
sprintf(longkey, "%s%u", data, extra);
unsigned char tmp[16];
md5mini(tmp, longkey);
if ((tmp[0] == 0) && (tmp[1] == 0) && (tmp[2] < 16)) break;
extra++;
}
printf("Follow your key with %u to obtain five zeroes\n", extra);
for (;;) {
sprintf(longkey, "%s%u", data, extra);
unsigned char tmp[16];
md5mini(tmp, longkey);
if ((tmp[0] == 0) && (tmp[1] == 0) && (tmp[2] == 0)) break;
extra++;
}
printf("Follow your key with %u to obtain six zeroes\n", extra);
}
struct House {
int row, col;
};
void aoc201503(char *data, size_t len) {
|