- the fourth.

This commit is contained in:
Christoph Oelckers 2017-03-08 18:47:52 +01:00
commit 8ab562ef13
107 changed files with 1041 additions and 1041 deletions

View file

@ -22,12 +22,12 @@
#include "templates.h"
#ifdef __BIG_ENDIAN__
void byteSwap(DWORD *buf, unsigned words)
void byteSwap(uint32_t *buf, unsigned words)
{
BYTE *p = (BYTE *)buf;
uint8_t *p = (uint8_t *)buf;
do {
*buf++ = (DWORD)((unsigned)p[3] << 8 | p[2]) << 16 |
*buf++ = (uint32_t)((unsigned)p[3] << 8 | p[2]) << 16 |
((unsigned)p[1] << 8 | p[0]);
p += 4;
} while (--words);
@ -55,9 +55,9 @@ void MD5Context::Init()
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void MD5Context::Update(const BYTE *buf, unsigned len)
void MD5Context::Update(const uint8_t *buf, unsigned len)
{
DWORD t;
uint32_t t;
/* Update byte count */
@ -67,13 +67,13 @@ void MD5Context::Update(const BYTE *buf, unsigned len)
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
if (t > len) {
memcpy((BYTE *)in + 64 - t, buf, len);
memcpy((uint8_t *)in + 64 - t, buf, len);
return;
}
/* First chunk is an odd size */
if (t < 64)
{
memcpy((BYTE *)in + 64 - t, buf, t);
memcpy((uint8_t *)in + 64 - t, buf, t);
byteSwap(in, 16);
MD5Transform(this->buf, in);
buf += t;
@ -96,7 +96,7 @@ void MD5Context::Update(const BYTE *buf, unsigned len)
void MD5Context::Update(FileReader *file, unsigned len)
{
BYTE readbuf[8192];
uint8_t readbuf[8192];
long t;
while (len != 0)
@ -112,10 +112,10 @@ void MD5Context::Update(FileReader *file, unsigned len)
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void MD5Context::Final(BYTE digest[16])
void MD5Context::Final(uint8_t digest[16])
{
int count = bytes[0] & 0x3f; /* Number of bytes in ctx->in */
BYTE *p = (BYTE *)in + count;
uint8_t *p = (uint8_t *)in + count;
/* Set the first char of padding to 0x80. There is always room. */
*p++ = 0x80;
@ -128,7 +128,7 @@ void MD5Context::Final(BYTE digest[16])
memset(p, 0, count + 8);
byteSwap(in, 16);
MD5Transform(buf, in);
p = (BYTE *)in;
p = (uint8_t *)in;
count = 56;
}
memset(p, 0, count);
@ -164,9 +164,9 @@ void MD5Context::Final(BYTE digest[16])
* the data and converts bytes into longwords for this routine.
*/
void
MD5Transform(DWORD buf[4], const DWORD in[16])
MD5Transform(uint32_t buf[4], const uint32_t in[16])
{
DWORD a, b, c, d;
uint32_t a, b, c, d;
a = buf[0];
b = buf[1];
@ -276,7 +276,7 @@ CCMD (md5sum)
else
{
MD5Context md5;
BYTE readbuf[8192];
uint8_t readbuf[8192];
size_t len;
while ((len = fread(readbuf, 1, sizeof(readbuf), file)) > 0)