Updated the C++ wrapper with new optional parameters.
This commit is contained in:
parent
b5b6e3eaf0
commit
73b7131b87
@ -33,11 +33,13 @@ namespace slunkcrypt
|
|||||||
class SlunkBase
|
class SlunkBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SlunkBase(const size_t thread_count)
|
SlunkBase(const size_t thread_count, const bool legacy_compat, const bool debug_logging)
|
||||||
{
|
{
|
||||||
std::memset(&m_param, 0, sizeof(m_param));
|
std::memset(&m_param, 0, sizeof(m_param));
|
||||||
m_param.version = ::SLUNKCRYPT_PARAM_VERSION;
|
m_param.version = ::SLUNKCRYPT_PARAM_VERSION;
|
||||||
m_param.thread_count = thread_count;
|
m_param.thread_count = thread_count;
|
||||||
|
m_param.legacy_compat = legacy_compat ? SLUNKCRYPT_TRUE : SLUNKCRYPT_FALSE;
|
||||||
|
m_param.debug_logging = debug_logging ? SLUNKCRYPT_TRUE : SLUNKCRYPT_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool process(const uint8_t *const input, uint8_t *const output, size_t length) = 0;
|
virtual bool process(const uint8_t *const input, uint8_t *const output, size_t length) = 0;
|
||||||
@ -56,7 +58,8 @@ namespace slunkcrypt
|
|||||||
class Encryptor : public SlunkBase
|
class Encryptor : public SlunkBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Encryptor(const std::string &passwd, const size_t thread_count = 0U) : SlunkBase(thread_count)
|
Encryptor(const std::string &passwd, const size_t thread_count = 0U, const bool legacy_compat = false, const bool debug_logging = false)
|
||||||
|
: SlunkBase(thread_count, legacy_compat, debug_logging)
|
||||||
{
|
{
|
||||||
if (::slunkcrypt_generate_nonce(&m_nonce) != SLUNKCRYPT_SUCCESS)
|
if (::slunkcrypt_generate_nonce(&m_nonce) != SLUNKCRYPT_SUCCESS)
|
||||||
{
|
{
|
||||||
@ -117,7 +120,8 @@ namespace slunkcrypt
|
|||||||
class Decryptor : public SlunkBase
|
class Decryptor : public SlunkBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Decryptor(const std::string &passwd, const uint64_t nonce, const size_t thread_count = 0U) : SlunkBase(thread_count)
|
Decryptor(const std::string &passwd, const uint64_t nonce, const size_t thread_count = 0U, const bool legacy_compat = false, const bool debug_logging = false)
|
||||||
|
: SlunkBase(thread_count, legacy_compat, debug_logging)
|
||||||
{
|
{
|
||||||
if ((m_instance = ::slunkcrypt_alloc_ext(nonce, (const uint8_t*)passwd.c_str(), passwd.length(), SLUNKCRYPT_DECRYPT, &m_param)) == SLUNKCRYPT_NULL)
|
if ((m_instance = ::slunkcrypt_alloc_ext(nonce, (const uint8_t*)passwd.c_str(), passwd.length(), SLUNKCRYPT_DECRYPT, &m_param)) == SLUNKCRYPT_NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user