diff options
author | louiz’ <louiz@louiz.org> | 2017-03-06 00:51:43 +0100 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-03-06 00:57:33 +0100 |
commit | 99a4ddedaf903d27b781341108433ae2d9533ad1 (patch) | |
tree | 2662dddda921d84f6fd348e46f154261ad46c17a /louloulibs/xmpp | |
parent | d81c3ad5ac2c12130d90044b7597bf962a7cfe9e (diff) | |
download | biboumi-99a4ddedaf903d27b781341108433ae2d9533ad1.tar.gz biboumi-99a4ddedaf903d27b781341108433ae2d9533ad1.tar.bz2 biboumi-99a4ddedaf903d27b781341108433ae2d9533ad1.tar.xz biboumi-99a4ddedaf903d27b781341108433ae2d9533ad1.zip |
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
Diffstat (limited to 'louloulibs/xmpp')
-rw-r--r-- | louloulibs/xmpp/auth.cpp | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/louloulibs/xmpp/auth.cpp b/louloulibs/xmpp/auth.cpp index c20f95d..8a34a4e 100644 --- a/louloulibs/xmpp/auth.cpp +++ b/louloulibs/xmpp/auth.cpp @@ -2,20 +2,7 @@ #include <utils/sha1.hpp> -#include <iomanip> -#include <sstream> - std::string get_handshake_digest(const std::string& stream_id, const std::string& secret) { - sha1nfo sha1; - sha1_init(&sha1); - sha1_write(&sha1, stream_id.data(), stream_id.size()); - sha1_write(&sha1, secret.data(), secret.size()); - const uint8_t* result = sha1_result(&sha1); - - std::ostringstream digest; - for (int i = 0; i < HASH_LENGTH; i++) - digest << std::hex << std::setfill('0') << std::setw(2) << static_cast<int>(result[i]); - - return digest.str(); + return sha1(stream_id + secret); } |