"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libjte/md5.c" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

md5.c  (xorriso-1.5.2):md5.c  (xorriso-1.5.4)
/* /*
* This file has been modified for the cdrkit suite. * This file has been modified for the cdrkit suite.
* *
* The behaviour and appearence of the program code below can differ to a major * The behaviour and appearance of the program code below can differ to a major
* extent from the version distributed by the original author(s). * extent from the version distributed by the original author(s).
* *
* For details, see Changelog file distributed with the cdrkit package. If you * For details, see Changelog file distributed with the cdrkit package. If you
* received this file from another source then ask the distributing person for * received this file from another source then ask the distributing person for
* a log of modifications. * a log of modifications.
* *
*/ */
/* /*
* This code implements the MD5 message-digest algorithm. * This code implements the MD5 message-digest algorithm.
skipping to change at line 303 skipping to change at line 303
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10); MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15); MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21); MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
buf[0] += a; buf[0] += a;
buf[1] += b; buf[1] += b;
buf[2] += c; buf[2] += c;
buf[3] += d; buf[3] += d;
} }
/* Read in a hex-dumped MD5 sum and parse it */
int mk_MD5Parse(unsigned char in[33], unsigned char out[16])
{
int i = 0;
for (i = 0; i < 16; i++)
{
if (in[2*i] >= '0' && in[2*i] <= '9')
in[2*i] -= '0';
else if (in[2*i] >= 'A' && in[2*i] <= 'F')
in[2*i] += 10 - 'A';
else if (in[2*i] >= 'a' && in[2*i] <= 'f')
in[2*i] += 10 - 'a';
else
return 1;
if (in[1+(2*i)] >= '0' && in[1+(2*i)] <= '9')
in[1+(2*i)] -= '0';
else if (in[1+(2*i)] >= 'A' && in[1+(2*i)] <= 'F')
in[1+(2*i)] += 10 - 'A';
else if (in[1+(2*i)] >= 'a' && in[1+(2*i)] <= 'f')
in[1+(2*i)] += 10 - 'a';
else
return 1;
out[i] = in[2*i] << 4 | in[1+(2*i)];
}
return 0;
}
/* Calculate the MD5sum of the specified file */
int calculate_md5sum(char *filename, uint64_t size, unsigned char out[16])
{
char buffer[32768];
FILE *infile = NULL;
uint64_t remain = 0;
int use;
struct mk_MD5Context file_context;
/* Start MD5 work for the file */
mk_MD5Init(&file_context);
infile = fopen(filename, "rb");
if (!infile)
{
#ifdef TEST
#ifndef HAVE_STRERROR
fprintf(stderr, "cannot open '%s': (%d)\n",
filename, errno);
#else
fprintf(stderr, "cannot open '%s': %s\n",
filename, strerror(errno));
#endif
exit(1);
#else /* TEST */
return -1;
#endif /* ! TEST */
}
remain = size;
while (remain > 0)
{
use = (remain > sizeof(buffer) ? sizeof(buffer) : remain);
if (fread(buffer, 1, use, infile) == 0)
{
#ifdef TEST
fprintf(stderr, "cannot read from '%s'\n", filename);
exit(1);
#else /* TEST */
return -1;
#endif /* ! TEST */
}
/* Update the checksum */
mk_MD5Update(&file_context, (unsigned char *)buffer, use);
remain -= use;
}
fclose(infile);
mk_MD5Final(&out[0], &file_context);
return 0;
}
#ifdef TEST #ifdef TEST
/* Simple test program. Can use it to manually run the tests from /* Simple test program. Can use it to manually run the tests from
RFC1321 for example. */ RFC1321 for example. */
#include <stdio.h> #include <stdio.h>
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
struct mk_MD5Context context; struct mk_MD5Context context;
unsigned char checksum[16]; unsigned char checksum[16];
 End of changes. 2 change blocks. 
81 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)