Nikola Petrov 29cfc93580 Fix delete
2023-08-26 17:20:45 +02:00

47 lines
989 B
C++

#pragma once
#include <fstream>
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, int len);
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);