Files
liagt/velvet_ring.h
2026-01-16 20:51:39 +08:00

26 lines
737 B
C++

#pragma once
#include <string>
#include <vector>
using ByteVec = std::vector<unsigned char>;
constexpr int IV_LEN = 12;
constexpr int KEY_LEN = 32;
constexpr int SALT_LEN = 16;
constexpr int TAG_LEN = 16;
// Function declarations
ByteVec rb(int bytes);
ByteVec ec_wky(const std::string& plain, const ByteVec& key);
std::string dec_wky(const ByteVec& data, const ByteVec& key);
struct DerivedKey {
ByteVec key;
ByteVec salt;
};
DerivedKey dervk_p(const std::string& password, const ByteVec* saltOpt = nullptr, int iterations = 200000);
ByteVec ec_p(const std::string& plain, const std::string& password);
std::string dec_p(const ByteVec& data, const std::string& password, int iterations = 200000);