-
Notifications
You must be signed in to change notification settings - Fork 0
/
tfdef.h
41 lines (32 loc) · 1.01 KB
/
tfdef.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
#ifndef _THREEFISH_NOISE_GENERATOR_CIPHER_DEFINITIONS_HEADER
#define _THREEFISH_NOISE_GENERATOR_CIPHER_DEFINITIONS_HEADER
#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif
#ifndef _BSD_SOURCE
#define _BSD_SOURCE
#endif
#include <stddef.h>
#include <stdint.h>
#include "machdefs.h"
#if defined(MACHINE_64BIT)
#define TFNG_UNIT_TYPE uint64_t
#define TFNG_NR_BLOCK_BITS 256
#define TFNG_NR_KEY_BITS 512
#else
#define TFNG_UNIT_TYPE uint32_t
#define TFNG_NR_BLOCK_BITS 128
#define TFNG_NR_KEY_BITS 256
#endif
#define TFNG_NR_BLOCK_UNITS 4
#define TFNG_NR_KEY_UNITS 8
#define TFNG_BYTE_TYPE uint8_t
#define TFNG_SIZE_UNIT (sizeof(TFNG_UNIT_TYPE))
#define TFNG_BLOCK_SIZE (TFNG_SIZE_UNIT * TFNG_NR_BLOCK_UNITS)
#define TFNG_KEY_SIZE (TFNG_SIZE_UNIT * TFNG_NR_KEY_UNITS)
#define TFNG_TO_BITS(x) ((x) * 8)
#define TFNG_FROM_BITS(x) ((x) / 8)
#define TFNG_MAX_BITS TFNG_NR_BLOCK_BITS
#define TFNG_UNIT_BITS (TFNG_SIZE_UNIT * 8)
void tfng_encrypt_rawblk(TFNG_UNIT_TYPE *O, const TFNG_UNIT_TYPE *I, const TFNG_UNIT_TYPE *K);
#endif