-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.h
45 lines (37 loc) · 1.1 KB
/
generator.h
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
37
38
39
40
41
42
43
44
#ifndef SIEGENTHALER_ATTACK_GENERATOR_H
#define SIEGENTHALER_ATTACK_GENERATOR_H
#include <stdint.h>
/**
* @brief Combine generator - cryptographic object which generates some pseudo-random sequence.
*/
struct Generator {
/**
* Number of LFSR in generator, where LFSR is linear-feedback shift register.
*/
uint8_t N;
/**
* @brief Reverse polynomials of feedback for LFSR.
* @size N
*/
uint16_t *reverse_polynomials;
/**
* @brief Initial states for LFSR
* @size N
*/
uint16_t *init_states;
};
typedef struct Generator Generator;
/**
* @param Number of LFSR in generator(Max number is 3 for now)
* @return initialized combine generator.
*/
Generator create_generator(uint8_t);
/**
* Generates pseudo-random sequence with <i>size</i> length with help of <i>generator</i>
* @param generator object to help generate sequence
* @param size length of output sequence
* @return pseudo-random sequence with <i>size</i> length
*/
uint8_t *generate_sequence(Generator, uint32_t);
extern uint16_t POLYNOMIALS[];
#endif // SIEGENTHALER_ATTACK_GENERATOR_H