Skip to content

Commit

Permalink
Update qryptonight.h
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFF0 committed Sep 21, 2022
1 parent f69f1cd commit cc6e01c
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions src/qryptonight/qryptonight.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,59 @@
#include <vector>
#include <string>
#include <stdexcept>
#include <xmrstak/backend/cpu/crypto/cryptonight_types.h>
#include <atomic>

#ifdef __arm__

#include "hash-ops.h"

#else

#include <xmrstak/backend/cpu/crypto/cryptonight_types.h>

#endif

class Qryptonight {
public:
Qryptonight();
virtual ~Qryptonight();

bool isValid() { return _context != nullptr; }
std::string lastError() { return std::string(_last_msg.warning ? _last_msg.warning : ""); }
bool isValid() {
#ifdef __arm__
return true;
#else
return _context != nullptr;
#endif
}


std::string lastError() {
#ifndef __arm__
return "";
#else
return std::string(_last_msg.warning ? _last_msg.warning : "");
#endif
}


std::vector<uint8_t> hash(const std::vector<uint8_t>& input);

protected:
#ifndef __arm__
//Protected variables are prefixed with an underscore
typedef void (*cn_hash_fn)(const void* input, size_t len, void* output, cryptonight_ctx* ctx0);
static cn_hash_fn _hash_fn;
#endif

static void init();
static std::atomic_bool _jconf_initialized;

#ifndef __arm__
alloc_msg _last_msg = { nullptr };
cryptonight_ctx *_context;
#endif
};

#endif //QRYPTONIGHT_QRYPTONIGHT_H


0 comments on commit cc6e01c

Please sign in to comment.