2010-02-23 15:15:44 +00:00
|
|
|
#include "base64.c"
|
2010-02-23 12:10:06 +00:00
|
|
|
|
2010-02-23 15:15:44 +00:00
|
|
|
#if 0 // inline this (see below)
|
|
|
|
static string xx2c(string xx) {
|
|
|
|
string c = " ";
|
|
|
|
c[0] = hex2int(xx);
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
#endif
|
2010-02-23 12:10:06 +00:00
|
|
|
|
|
|
|
string hmac_bin(int method, string key, string arg) {
|
2010-02-23 15:15:44 +00:00
|
|
|
string c = " ";
|
|
|
|
return regreplace(hmac(method, key, arg), "..", (:
|
|
|
|
c[0] = hex2int($1);
|
|
|
|
return c;
|
|
|
|
:), 1);
|
2010-02-23 12:10:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
string hmac_base64(int method, string key, string arg) {
|
|
|
|
return encode_base64((int *)hmac_bin(method, key, arg));
|
|
|
|
}
|