summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-16 12:31:41 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-16 12:31:41 +0000
commit49fc1a8b9b5858974f90b9d2ed14ba5442c8cbfc (patch)
tree0f2e69541ce8636e696459326872299a4c201489 /tools
parent30ee89a6764a8d38a078374c6ed5de70635b42c0 (diff)
mir_md5_byte_t => BYTE;
macros mir_base64_encode_bufsize for calculating buffer size macros mir_base64_encodebuf for in-place base64 encoding git-svn-id: http://svn.miranda-ng.org/main/trunk@5716 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'tools')
-rw-r--r--tools/checksum/checksum.cpp6
-rw-r--r--tools/checksum/commonheaders.h10
-rw-r--r--tools/checksum/md5.cpp24
3 files changed, 20 insertions, 20 deletions
diff --git a/tools/checksum/checksum.cpp b/tools/checksum/checksum.cpp
index 9778a2c66c..6318cc66a6 100644
--- a/tools/checksum/checksum.cpp
+++ b/tools/checksum/checksum.cpp
@@ -43,7 +43,7 @@ static void PatchResourcesDirectory(PIMAGE_RESOURCE_DIRECTORY pIRD, PBYTE pBase)
PatchResourceEntry(pIRDE, pBase);
}
-int PEChecksum( TCHAR *filename, mir_md5_byte_t digest[16] )
+int PEChecksum( TCHAR *filename, BYTE digest[16] )
{
HANDLE hFile = INVALID_HANDLE_VALUE;
HANDLE hMap;
@@ -364,7 +364,7 @@ int PEChecksum( TCHAR *filename, mir_md5_byte_t digest[16] )
if ( debug )
{
int i;
- mir_md5_byte_t digest2[16];
+ BYTE digest2[16];
mir_md5_state_t pms2;
mir_md5_init( &pms2 );
@@ -423,7 +423,7 @@ TCHAR* trtrim( TCHAR *str )
int process(TCHAR *filename)
{
int res;
- mir_md5_byte_t digest[16] = {0};
+ BYTE digest[16] = {0};
res = PEChecksum( filename, digest);
diff --git a/tools/checksum/commonheaders.h b/tools/checksum/commonheaders.h
index dcd24ecf1b..4797a00c4a 100644
--- a/tools/checksum/commonheaders.h
+++ b/tools/checksum/commonheaders.h
@@ -17,16 +17,16 @@
/* Define the state of the MD5 Algorithm. */
-typedef unsigned char mir_md5_byte_t; /* 8-bit byte */
+typedef unsigned char BYTE; /* 8-bit byte */
typedef unsigned int mir_md5_word_t; /* 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 */
+ 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]);
diff --git a/tools/checksum/md5.cpp b/tools/checksum/md5.cpp
index a7d7a641e3..b5ea0fa8b3 100644
--- a/tools/checksum/md5.cpp
+++ b/tools/checksum/md5.cpp
@@ -122,7 +122,7 @@
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
//gfd*
-static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]*/)
+static void md5_process(mir_md5_state_t *pms, const BYTE *data /*[64]*/)
{
mir_md5_word_t
a = pms->abcd[0], b = pms->abcd[1],
@@ -140,13 +140,13 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]*
*/
static const int w = 1;
- if (*((const mir_md5_byte_t *)&w)) /* dynamic little-endian */
+ if (*((const BYTE *)&w)) /* dynamic little-endian */
{
/*
* On little-endian machines, we can process properly aligned
* data without copying it.
*/
- if ( !((data - (const mir_md5_byte_t *)0) & 3)) {
+ if ( !((data - (const BYTE *)0) & 3)) {
/* data are properly aligned */
X = (const mir_md5_word_t *)data;
} else {
@@ -161,7 +161,7 @@ static void md5_process(mir_md5_state_t *pms, const mir_md5_byte_t *data /*[64]*
* On big-endian machines, we must arrange the bytes in the
* right order.
*/
- const mir_md5_byte_t *xp = data;
+ const BYTE *xp = data;
int i;
X = xbuf; /* (dynamic only) */
@@ -290,9 +290,9 @@ MIR_CORE_DLL(void) mir_md5_init(mir_md5_state_t *pms)
pms->abcd[3] = 0x10325476;
}
-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_append(mir_md5_state_t *pms, const BYTE *data, int nbytes)
{
- const mir_md5_byte_t *p = data;
+ const BYTE *p = data;
int left = nbytes;
int offset = (pms->count[0] >> 3) & 63;
mir_md5_word_t nbits = (mir_md5_word_t)(nbytes << 3);
@@ -327,29 +327,29 @@ MIR_CORE_DLL(void) mir_md5_append(mir_md5_state_t *pms, const mir_md5_byte_t *da
memcpy(pms->buf, p, left);
}
-MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, mir_md5_byte_t digest[16])
+MIR_CORE_DLL(void) mir_md5_finish(mir_md5_state_t *pms, BYTE digest[16])
{
- static const mir_md5_byte_t pad[64] = {
+ static const BYTE pad[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
- mir_md5_byte_t data[8];
+ BYTE data[8];
int i;
/* Save the length before padding. */
for (i = 0; i < 8; ++i)
- data[i] = (mir_md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
+ data[i] = (BYTE)(pms->count[i >> 2] >> ((i & 3) << 3));
/* Pad to 56 bytes mod 64. */
mir_md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
mir_md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
- digest[i] = (mir_md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
+ digest[i] = (BYTE)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
-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_hash(const BYTE *data, int len, BYTE digest[16])
{
mir_md5_state_t state;
mir_md5_init(&state);