Remove hex encoding, just write binary files.
This commit is contained in:
12
crypto.cc
12
crypto.cc
@@ -20,18 +20,6 @@ CryptoBase::~CryptoBase() {
|
||||
}
|
||||
}
|
||||
|
||||
std::string CryptoBase::BinToHex(const std::string& bin) {
|
||||
static const char *hex = "0123456789ABCDEF";
|
||||
std::string ret;
|
||||
ret.reserve(bin.length() * 2);
|
||||
for (size_t i = 0; i < bin.length(); i++) {
|
||||
const char c = bin[i];
|
||||
ret.push_back(hex[(c & 0xf0) >> 4]);
|
||||
ret.push_back(hex[c & 0x0f]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CryptoBase::GenKey(std::string* key) {
|
||||
char buf[crypto_secretbox_KEYBYTES];
|
||||
randombytes((unsigned char *)buf, crypto_secretbox_KEYBYTES);
|
||||
|
||||
Reference in New Issue
Block a user