summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/delphi/m_core.inc2
-rw-r--r--include/m_core.h22
2 files changed, 16 insertions, 8 deletions
diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc
index 7462e63d9a..abc3713971 100644
--- a/include/delphi/m_core.inc
+++ b/include/delphi/m_core.inc
@@ -603,6 +603,8 @@ function mir_base64_decode(str:pAnsiChar; var resultSize:int):PByte; stdcall;
external CoreDLL name 'mir_base64_decode';
function mir_base64_encode(data:PByte; dataSize:int):pAnsiChar; stdcall;
external CoreDLL name 'mir_base64_encode';
+function mir_base64_encodebuf(data:PByte; dataSize:int; output:pAnsiChar; outputLen:int):pAnsiChar; stdcall;
+ external CoreDLL name 'mir_base64_encodebuf';
function rtrim(str:pAnsiChar):pAnsiChar; stdcall;
external CoreDLL name 'rtrim';
diff --git a/include/m_core.h b/include/m_core.h
index 3fdb81a747..e7f7e4f919 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -535,19 +535,19 @@ MIR_CORE_DLL(int) mir_writeLogVW(HANDLE logger, const WCHAR *format, va_list arg
// md5 functions
/* Define the state of the MD5 Algorithm. */
-typedef unsigned char mir_md5_byte_t; /* 8-bit byte */
-typedef unsigned int mir_md5_word_t; /* 32-bit word */
+typedef unsigned char BYTE; /* 8-bit byte */
+typedef unsigned int UINT32; /* 32-bit word */
typedef struct mir_md5_state_s {
- mir_md5_word_t count[2]; /* message length in bits, lsw first */
- mir_md5_word_t abcd[4]; /* digest buffer */
- mir_md5_byte_t buf[64]; /* accumulate block */
+ UINT32 count[2]; /* message length in bits, lsw first */
+ UINT32 abcd[4]; /* digest buffer */
+ BYTE buf[64]; /* accumulate block */
} mir_md5_state_t;
MIR_CORE_DLL(void) mir_md5_init(mir_md5_state_t *pms);
-MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const mir_md5_byte_t *data, int nbytes);
-MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, mir_md5_byte_t digest[16]);
-MIR_CORE_DLL(void) mir_md5_hash(const mir_md5_byte_t *data, int len, mir_md5_byte_t digest[16]);
+MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const BYTE *data, int nbytes);
+MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, BYTE digest[16]);
+MIR_CORE_DLL(void) mir_md5_hash(const BYTE *data, int len, BYTE digest[16]);
///////////////////////////////////////////////////////////////////////////////
// memory functions
@@ -675,6 +675,12 @@ MIR_CORE_DLL(void) mir_hmac_sha1(BYTE hashout[MIR_SHA1_HASH_SIZE], const BYTE *k
MIR_CORE_DLL(void*) mir_base64_decode(const char *input, unsigned *outputLen);
MIR_CORE_DLL(char*) mir_base64_encode(const BYTE *input, unsigned inputLen);
+MIR_CORE_DLL(char*) mir_base64_encodebuf(const BYTE *input, unsigned inputLen, char *output, unsigned outLen);
+
+__forceinline unsigned mir_base64_encode_bufsize(unsigned inputLen)
+{
+ return 4 * ((inputLen + 2) / 3) + 1;
+}
MIR_CORE_DLL(char*) rtrim(char *str);
MIR_CORE_DLL(WCHAR*) rtrimw(WCHAR *str);