-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared.h
84 lines (75 loc) · 1.58 KB
/
shared.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include <stdio.h>
#include <stdlib.h> // exit(), rand(), malloc()
#include <string.h> // strcmp(), strcpy(), strlen()
#include <time.h> // time()
#include <ctype.h> // isupper(), ispunct(), isdigit()
#include <stdint.h>
#include <stdbool.h>
#ifdef _WIN32
#include <windows.h>
#endif
#define APP_VERSION "v1.72"
#define MAXTITLE 31
#define MAXID 31
#define MAXPW 21
#define MAXMISC 51
#define MAXLINE 150
#define MINPW 6
#define MINCHARS 0
#define MAXCHARS 6
#define DBPASSWORDSIZE 32
#define IV_SIZE 17
#define INI_FILE "trove.ini"
#define DB_FILE "trove.db"
void readEntries(void);
void saveEntries(void);
void sortEntries(void);
void generatePassword(char *);
void generateKeygen(char *);
bool setDBpassword(void);
void readSettings(char *);
void writeSettings(char *);
void writeFile(char *);
void readFile(char *);
void encrypt_cbc(uint8_t *, uint8_t *);
void decrypt_cbc(uint8_t *, uint8_t *);
void addPadding(char *);
void loadEncryptedEntries(void);
void updateBuffer(void);
void removeCommas(char *, int);
void lowerCase(char *, int);
void clearArray(char *, int);
void exportDB(void);
struct Entry
{
char title[MAXTITLE];
char id[MAXID];
char pw[MAXPW];
char misc[MAXMISC];
} *entries;
struct Settings
{
int passwordSize;
int minSpecial;
int minNumeric;
int minUppercase;
int screenRow;
int screenCol;
char iv[IV_SIZE];
} settings;
struct State
{
char DBpassword[DBPASSWORDSIZE];
bool noDatabase;
int entryCount;
int bufferSize;
int paddedSize;
#ifdef _WIN32
bool running;
bool debugging;
bool readVerified;
bool changingPassword;
LRESULT selectedRow;
#endif
} state;