Changed to use gnutls instead of openssl for sha1 hashing

This commit is contained in:
James Booth
2014-05-01 22:18:04 +01:00
parent f44cf86f23
commit 524b1f2383
8 changed files with 98 additions and 17 deletions

View File

@@ -31,6 +31,8 @@
#include <curl/curl.h>
#include <curl/easy.h>
#include <glib.h>
#include <gnutls/gnutls.h>
#include <gnutls/crypto.h>
#include "log.h"
#include "common.h"
@@ -388,6 +390,21 @@ generate_unique_id(char *prefix)
return result;
}
char *
sha1_hash(char *str)
{
gnutls_hash_hd_t dig;
gnutls_digest_algorithm_t algorithm = GNUTLS_DIG_SHA1;
gnutls_hash_init(&dig, algorithm);
gnutls_hash(dig, str, strlen(str));
unsigned char output[20];
gnutls_hash_output(dig, output);
return g_base64_encode(output, sizeof(output));
}
int
cmp_win_num(gconstpointer a, gconstpointer b)
{