summaryrefslogtreecommitdiff
path: root/lib/lib3.h
blob: b37021dc18e515b4cfec1caf9b1c0e9931cdffa8 (plain)
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
34
35
36
#ifndef __LIB3_H__
#define __LIB3_H__

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/aes.h>
#include <unistd.h>
#include <time.h>

#define BLOCKSIZE 16

#define MT_19937_N 624
// needed for initialization
#define MT_19937_F 0x6C078965
// word size
#define MT_19937_W 32
#define MT_19937_UPPER_MASK 0x80000000
#define MT_19937_LOWER_MASK 0x7fffffff

struct mt_19937_state {
	unsigned int mt[MT_19937_N];
	unsigned int index;
};

char *challenge17_encrypt(int *length);
int cbc_padding_oracle(char *encrypted, int length);
int aes_ctr(char *in, int length_in, char *out, char *string_key, char *nonce);

void mt_19937_seed(unsigned int seed, struct mt_19937_state *mt_state);
unsigned int mt_19937(struct mt_19937_state *mt_state);
unsigned int mt_19937_timestamp_orcale(struct mt_19937_state *mt_state);
void mt_19937_brute_force_timestamp();
int unshift_left_xor(int number, int shifts, unsigned int mask);
int unshift_right_xor(int number, int shifts);
#endif