recover_local_secret.c 812 Bytes
Newer Older
Adam Blank's avatar
Adam Blank committed
1
2
3
4
5
6
7
#include <stdlib.h>
#include <stdio.h>

#include "util.h"

#include "stage3.h"

Caleb C. Sander's avatar
Caleb C. Sander committed
8
9
10
const size_t MIN_CHOICE = 'A' - 1;
const size_t MAX_CHOICE = 'Z' + 1;
const size_t SECRET_LENGTH = 5;
Adam Blank's avatar
Adam Blank committed
11

Caleb C. Sander's avatar
Caleb C. Sander committed
12
static inline page_t *init_pages(void) {
Adam Blank's avatar
Adam Blank committed
13
14
15
16
17
18
19
20
21
22
23
24
    return calloc(MAX_CHOICE, sizeof(page_t));
}

static inline void flush_all_pages(page_t *pages) {
    // TODO: Copy me from the previous stage
}

static inline size_t guess_accessed_page(page_t *pages) {
    // TODO: Copy me from the previous stage
    return 0;
}

25
static inline void do_access(page_t *pages, size_t idx) {
Adam Blank's avatar
Adam Blank committed
26
27
28
29
    // TODO: Implement me using force_read.  I am a very short function.
}

int main() {
30
    page_t *pages = init_pages();
Adam Blank's avatar
Adam Blank committed
31
32
33
34

    // TODO: Copy me from the previous stage and edit me so I loop over SECRET_LENGTH characters.

    printf("\n");
35
    free(pages);
Adam Blank's avatar
Adam Blank committed
36
}