Remove hex encoding, just write binary files.

This commit is contained in:
Ian Gulliver
2015-02-05 17:18:44 +00:00
parent 18715be4b9
commit 524434813c
4 changed files with 3 additions and 19 deletions

View File

@@ -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);