[feat] use AES to encrypt image names

This commit is contained in:
dijunkun
2024-11-12 17:30:28 +08:00
parent 526eb4bb31
commit f9d024e971
9 changed files with 379 additions and 198 deletions

View File

@@ -20,7 +20,8 @@ class Thumbnail {
public:
int SaveToThumbnail(const char* yuv420p, int width, int height,
const std::string& host_name,
const std::string& remote_id);
const std::string& remote_id,
const std::string& password);
int LoadThumbnail(SDL_Renderer* renderer,
std::map<std::string, SDL_Texture*>& textures, int* width,
@@ -32,12 +33,20 @@ class Thumbnail {
std::vector<std::filesystem::path> FindThumbnailPath(
const std::filesystem::path& directory);
std::string AES_encrypt(const std::string& key, const std::string& plaintext);
std::string AES_decrypt(const std::string& key,
const std::string& ciphertext);
private:
int thumbnail_width_ = 160;
int thumbnail_height_ = 90;
char* rgba_buffer_ = nullptr;
std::string image_path_ = "thumbnails";
std::string image_path_ = "thumbnails/";
std::map<std::time_t, std::filesystem::path> thumbnails_sorted_by_write_time_;
std::string key_ = "1234567890123456";
std::string iv_ = "1234567890123456";
};
#endif