-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanager.h
40 lines (31 loc) · 1.39 KB
/
manager.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
#ifndef MANAGER_H_INCLUDED
#define MANAGER_H_INCLUDED
/* We use to encrypt the characters between '' and '~' which let us 222 possibilities of rotation for each
* wchar_t.*/
#define LAST_RASCII 254
#define FIRST_RASCII ' '
/* default collatz startkey */
#define KEY 12345
/*the break point for collatz sequence : in other words reloop seq when it reach this value */
#define DEFAULT_MIN_SEQ 16
/* use jump line character '\n' if defined */
#define ENTER
/* Enable assert in release mode */
#undef NDEBUG
#include <assert.h>
#include <wchar.h>
typedef struct
{
size_t len; /*the length of the message */
size_t cp_print; /*The number of characters that can't be printable after encryption. */
unsigned key; /*secret encryption key (defined by user as a alphanum password then => hashtable to get key)*/
unsigned startval; /*the value used to start the sequence of collatz (choosed by user or by default)*/
unsigned minseq; /*the minimum value the sequence could reach.*/
wchar_t *codedMsg; /*contain encrypted data or NULL if error*/
wchar_t *clearMsg; /*contain decrypted or NULL */
} Collatz;
extern void coll_Init(Collatz *, const char * const, unsigned);
extern wchar_t *coll_Encrypt(Collatz *, const wchar_t * const);
extern wchar_t *coll_Decrypt(Collatz *);
extern void coll_dispose(Collatz *);
#endif