mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-27 15:25:54 -04:00
downloader: Use built-in MD5 implemention for HTTPDigestAuthorization
This code is only compiled when OpenSSL is enabled at the moment, but this will change when webgl-port is merged
This commit is contained in:
parent
126cd374e9
commit
b3730bf707
@ -15,11 +15,10 @@
|
|||||||
|
|
||||||
#ifdef HAVE_OPENSSL
|
#ifdef HAVE_OPENSSL
|
||||||
|
|
||||||
#include "httpChannel.h"
|
#include "hashVal.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "openSSLWrapper.h" // must be included before any other openssl.
|
#include "urlSpec.h"
|
||||||
#include <openssl/ssl.h>
|
|
||||||
#include <openssl/md5.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
@ -292,19 +291,9 @@ get_hex_nonce_count() const {
|
|||||||
*/
|
*/
|
||||||
string HTTPDigestAuthorization::
|
string HTTPDigestAuthorization::
|
||||||
calc_md5(const string &source) {
|
calc_md5(const string &source) {
|
||||||
unsigned char binary[MD5_DIGEST_LENGTH];
|
HashVal hv;
|
||||||
|
hv.hash_string(source);
|
||||||
MD5((const unsigned char *)source.data(), source.length(), binary);
|
return hv.as_hex();
|
||||||
|
|
||||||
string result;
|
|
||||||
result.reserve(MD5_DIGEST_LENGTH * 2);
|
|
||||||
|
|
||||||
for (int i = 0; i < MD5_DIGEST_LENGTH; i++) {
|
|
||||||
result += hexdigit((binary[i] >> 4) & 0xf);
|
|
||||||
result += hexdigit(binary[i] & 0xf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream &
|
ostream &
|
||||||
|
Loading…
x
Reference in New Issue
Block a user