diff options
Diffstat (limited to 'Cryptor.cpp')
-rw-r--r-- | Cryptor.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Cryptor.cpp b/Cryptor.cpp index fc27caf..25a2ae9 100644 --- a/Cryptor.cpp +++ b/Cryptor.cpp @@ -226,10 +226,9 @@ void Cryptor::rekey() { }
void Cryptor::sha256(std::string str) {
- CryptoPP::SHA256 hash;
- std::string rtr;
- CryptoPP::StringSource(str, true, new CryptoPP::HashFilter(hash, new CryptoPP::StringSink(rtr), false, CryptoPP::AES::DEFAULT_KEYLENGTH));
- memcpy(key, rtr.c_str(), rtr.size());
+ unsigned char hashbuf[32];
+ mbedtls_sha256((const unsigned char *)str.c_str(), str.size(), hashbuf, 0);
+ memcpy(key, hashbuf, sizeof(key));
haveKey = true;
}
|