-
Notifications
You must be signed in to change notification settings - Fork 0
/
Encrypt.h
49 lines (41 loc) · 1.76 KB
/
Encrypt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef ENCRYPT_H
#define ENCRYPT_H
#include <iostream>
#include <fstream>
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <openssl/sha.h>
#include <curl/curl.h>
#include <nlohmann/json.hpp>
struct Utxo {
std::string address;
std::string txid;
int32_t vout;
double amount;
Utxo() : address(), txid(), vout(), amount() {}
Utxo(const std::string & address, const std::string& txid, int32_t vout, double amount)
: address(address), txid(txid), vout(vout), amount(amount) {}
};
std::pair<std::string, std::string> readIn(const std::string keyFile, const std::string encFile);
std::string encrypt(const std::string & key, const std::string & enc, const std::string & mode);
std::string hashing(const std::string& hex, const std::string & enc, const std::string & mode);
bool ChecksumIsValid(const std::vector<unsigned char>& vec);
std::string EncodeHex(const std::vector<unsigned char>& vec);
bool decodeBase58(const char* psz, std::vector<unsigned char>& vec);
std::string binaryToPlainText(const std::string& binary);
std::string hexToBinary(const std::string& hex);
std::string xorStrings(const std::string & a, const std::string & b);
bool decodeBase58Check(const std::string& str, std::vector<unsigned char>& vchRet);
std::string toBinary(const std::string& data);
std::string plainTextToBinary(const std::string& plainText);
std::string binaryToHex(const std::string& binary);
nlohmann::json sendRPC(const std::string& method, const nlohmann::json& params);
size_t callback(const char* in, size_t size, size_t num, std::string* out);
std::string createTransaction(const std::string & encryptedHex);
std::string getOP_RETURN(const std::string & txid);
#endif // ENCRYPT_H