Skip to content

Commit

Permalink
0.2a
Browse files Browse the repository at this point in the history
  • Loading branch information
creaktive committed Jul 19, 2003
1 parent 8b4ccc3 commit f8c911f
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 23 deletions.
21 changes: 19 additions & 2 deletions Readme.txt
@@ -1,5 +1,5 @@
MD5/SHA1 checksum generator/checker v0.2 for Total Commander
============================================================
MD5/SHA1 checksum generator/checker v0.2a for Total Commander
=============================================================


* How to install this plugin (32 bit only):
Expand Down Expand Up @@ -73,6 +73,8 @@ same, just replace every "md5" you see by "sha" :)
* Bugs:
-------

o You can mess MD5 with SHA1 checksums in same file. This has some funny
consequences... Try adding both SHA1 & MD5 sums for same filename :P
o Total Commander integration is a mess.
o NOT overwriting sensitive data is user's responsability :)
o I tried to make the best ".md5" parser I could with no Perl regexp.
Expand All @@ -83,6 +85,21 @@ same, just replace every "md5" you see by "sha" :)
date 15/31/2107 and time 31:63:62. Guess why :)


* ChangeLog:
------------

- v0.1
* first public release
- v0.2
* added support for SHA1
* renamed to "checksum.wcx"
- v0.2a
* checksum.wcx size dropped from 25.5 Kb to 8 Kb (!!!)
* replaced is*() functions from runtime by c00l macro hacks
* fixed memory leak in parser
* added ChangeLog :)


* TODO:
-------

Expand Down
7 changes: 4 additions & 3 deletions checksum.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions parser.c
Expand Up @@ -31,7 +31,7 @@ sum_node *sum_parse(const char *list)
char *line, *sum, *name;
int i, j, len, type;
char *p, *q;
sum_node *head = NULL, *last = NULL, *new;
sum_node *head = NULL, *last = NULL, *newone;

if ((f = fopen(list, "rt")) == NULL)
return NULL;
Expand All @@ -40,7 +40,7 @@ sum_node *sum_parse(const char *list)
while (fgets(buf, sizeof(buf), f) != NULL)
{
line = NULL;
sum = NULL;
sum = NULL;
name = NULL;
type = -1;

Expand All @@ -67,7 +67,7 @@ sum_node *sum_parse(const char *list)
if (!isxdigit(line[i+j]))
break;

if (!isalnum(line[i-1]) && !isalnum(line[i+j]))
if ((!i || !isalnum(line[i-1])) && !isalnum(line[i+j]))
{
type = j;
if (type == MD5 || type == SHA1)
Expand All @@ -84,6 +84,7 @@ sum_node *sum_parse(const char *list)
// filename after checksum
for (p = sum + type; p < line + len; p++)
if (!isspace(*p) && (*p != '*'))
//if (*p!=0x20 && (*p != '*'))
{
name = p;
break;
Expand Down Expand Up @@ -112,27 +113,27 @@ sum_node *sum_parse(const char *list)

if (name != NULL)
{
new = (sum_node *) malloc(sizeof(sum_node));
newone = (sum_node *) malloc(sizeof(sum_node));

new->type = type;
newone->type = type;

len = strlen(name) + 1;
new->filename = (char *) malloc(len);
newone->filename = (char *) malloc(len);

memset(new->filename, '\0', len);
strncpy(new->filename, name, len);
memset(newone->filename, '\0', len);
strncpy(newone->filename, name, len);

memset(new->checksum, '\0', sizeof(new->checksum));
memset(newone->checksum, '\0', sizeof(newone->checksum));
for (i = 0; i < type; i++)
new->checksum[i] = tolower(sum[i]);
newone->checksum[i] = tolower(sum[i]);

new->next = NULL;
newone->next = NULL;

if (last == NULL)
head = new;
head = newone;
else
last->next = new;
last = new;
last->next = newone;
last = newone;
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion parser.h
Expand Up @@ -25,7 +25,17 @@
#ifndef _PARSER_H
#define _PARSER_H

#include <ctype.h>
//#include <ctype.h>
/* eradicate "Microsoft Visual C++ Runtime Library" */
#undef isspace
#define isspace(c) (((c>=0x9&&c<=0xd)||(c==0x20))?1:0)
#undef isxdigit
#define isxdigit(c) (((c>='0'&&c<='9')||(c>='a'&&c<='f')||(c>='A'&&c<='F'))?1:0)
#undef isalnum
#define isalnum(c) (((c>='0'&&c<='9')||(c>='a'&&c<='z')||(c>='A'&&c<='Z'))?1:0)
#undef tolower
#define tolower(c) ((c>='A'&&c<='Z')?(c+('a'-'A')):c)

#include <malloc.h>
#include <memory.h>
#include <stdio.h>
Expand Down
13 changes: 10 additions & 3 deletions wcx.c
Expand Up @@ -21,6 +21,13 @@
Site: http://sysdlabs.hypermart.net/
****************************************************************************/


/* non-critical optimizations (combine with UPX :) */

#pragma comment(linker,"/ENTRY:DllMain")
#pragma comment(linker,"/NODEFAULTLIB:libcmt.lib")
#pragma comment(lib,"msvcrt.lib")

#define WIN32_LEAN_AND_MEAN

#include <windows.h>
Expand All @@ -32,7 +39,7 @@


#define SUM_BUFSIZE 32768
#define VERSION "v0.2"
#define VERSION "v0.2a"


typedef struct
Expand Down Expand Up @@ -426,9 +433,9 @@ void __stdcall ConfigurePacker(HWND Parent, HINSTANCE DllInstance)
"Provides MD5/SHA1 checksum generator/checker\n"
"from within Total Commander packer interface\n\n"

"Copyright © 2003 Stanislaw Y. Pusep\n"
"Copyright © 2004 Stanislaw Y. Pusep\n"
"stanis@linuxmail.org\n"
"http://sysdlabs.hypermart.net/proj/",
"http://sysdlabs.hypermart.net/proj/tc.shtml",

"MD5/SHA1 checksum wrapper " VERSION,

Expand Down

0 comments on commit f8c911f

Please sign in to comment.