Remove the embedded sha1 code, and use one of botan or gcrypt

This adds a hard dependency on one of Botan or gcrypt. Botan is already a
recommended dependency, and gcrypt is probably packaged almost everywhere,
so this should not be a big deal.

ref #3241
This commit is contained in:
louiz’
2017-03-06 00:57:33 +01:00
parent d81c3ad5ac
commit 99a4ddedaf
8 changed files with 84 additions and 170 deletions
+1 -8
View File
@@ -38,14 +38,7 @@ void IdentdSocket::parse_in_buffer(const std::size_t)
static std::string hash_jid(const std::string& jid)
{
sha1nfo sha1;
sha1_init(&sha1);
sha1_write(&sha1, jid.data(), jid.size());
const uint8_t* res = sha1_result(&sha1);
std::ostringstream result;
for (int i = 0; i < HASH_LENGTH; i++)
result << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(res[i]);
return result.str();
return sha1(jid);
}
std::string IdentdSocket::generate_answer(const BiboumiComponent& biboumi, uint16_t local, uint16_t remote)