2023-08-26 02:05:10 +02:00

49 lines
1018 B
C++

#pragma once
#include <fstream>
constexpr auto MAX_STRING_SIZE = 15;
class Buffer;
struct Pass
{
uint32_t label;
uint32_t password;
};
struct Index
{
uint32_t count;
uint32_t offset;
};
enum class Arg
{
Get, // get password for label
Generate, // generate password for label
List, // list all labels
Delete, // delete password for label
Print_all_p, // print all passwords
Input, // input password for label
Change, // change main password
Show, // show password for label
Error // error
};
int find_password_in_buffer(Buffer& buff, const char* label);
void delete_password_from_buffer(Buffer& in, Buffer& out, int index_of_pass);
void add_password_to_buffer(Buffer& in, const char* label, const char* password);
const char* get_password_from_buffer(Buffer& decrypted_buffer, int label);
void generate_password(std::string& password);
bool save_buffer_to_file(Buffer& buffer);
bool load_buffer_from_file(Buffer& buffer);
void print_usage();
Arg get_args(int argc, char** argv, char** label);