Project

General

Profile

« Previous | Next » 

Revision f16b75e3

Added by david.sorber over 2 years ago

Significant improvements including reading input from encrypted file.
Also added crypto utility to en/decrypt a file.

View differences:

src/Catalog.h
#ifndef __CATALOG_H__
#define __CATALOG_H__
#include <climits>
#include <cstdint>
#include <string>
#include <vector>
......
~Catalog();
int load(
char* filePath,
char* passwordBuffer,
uint32_t passwordBufferSize,
float* complete);
inline bool getLoaded() const
{
return m_loaded;
}
inline std::vector<CatalogItem>::iterator begin()
{
return m_catalog.begin();
......
void filter(const std::string& criteria);
static const char* errToString(int err)
{
switch (err)
{
case ERR_PWHASH_OUT_OF_MEMORY:
return "pwhash: out of memory";
case ERR_DECRYPT_INCOMPLETE_HEADER:
return "decrypt: incomplete header";
case ERR_DECRYPT_CORRUPTED_CHUNK:
return "decrypt: corrupted chunk";
case ERR_DECRYPT_PREMATURE_END:
return "decrypt: premature end of file";
default:
return "unknown error";
}
}
private:
static inline const int ERR_PWHASH_OUT_OF_MEMORY = INT_MIN + 19;
static inline const int ERR_DECRYPT_INCOMPLETE_HEADER = INT_MIN + 20;
static inline const int ERR_DECRYPT_CORRUPTED_CHUNK = INT_MIN + 21;
static inline const int ERR_DECRYPT_PREMATURE_END = INT_MIN + 22;
void sort();
bool m_loaded;
std::vector<CatalogItem> m_catalog;
};

Also available in: Unified diff