From: Gordon M. <go...@us...> - 2003-02-24 10:58:40
|
Update of /cvsroot/bitcollider/bitcollider/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23606/lib Modified Files: bitprint.c gui_win32.rc main.c tigertree.c Log Message: tigertree fix & related changes to sanity check, version number, about box Index: bitprint.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/bitprint.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** bitprint.c 5 Dec 2001 18:43:52 -0000 1.3 --- bitprint.c 24 Feb 2003 10:58:36 -0000 1.4 *************** *** 72,78 **** #define ONE_SHA "GVVBSK3ZCOYEYVCXJUMMFDKG4Y4VIKFL" #define ONEK_SHA "CAE54LXWDA55NWGAR4PNRX2II7TR66WL" ! #define EMPTY_TIGER "GKJ2YYYMCPYCIX4SXOYXM3QWCZ5E4WCJFXPHH4Y" ! #define ONE_TIGER "DVLTDFFAK3VTEAHZ2MBJADEEHQ6UDK2O2BWAHXY" ! #define ONEK_TIGER "2FMTCKHTA3ORYKBRIWJAL4KMZOCD4Z27AIPS5IQ" static int check_sha1_hash(const char *result, unsigned char *data, int len); --- 72,78 ---- #define ONE_SHA "GVVBSK3ZCOYEYVCXJUMMFDKG4Y4VIKFL" #define ONEK_SHA "CAE54LXWDA55NWGAR4PNRX2II7TR66WL" ! #define EMPTY_TIGER "LWPNACQDBZRYXW3VHJVCJ64QBZNGHOHHHZWCLNQ" ! #define ONE_TIGER "QMLU34VTTAIWJQM5RVN4RIQKRM2JWIFZQFDYY3Y" ! #define ONEK_TIGER "CDYY2OW6F6DTGCH3Q6NMSDLSRV7PNMAL3CED3DA" static int check_sha1_hash(const char *result, unsigned char *data, int len); Index: gui_win32.rc =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/gui_win32.rc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** gui_win32.rc 6 Apr 2001 04:39:05 -0000 1.4 --- gui_win32.rc 24 Feb 2003 10:58:36 -0000 1.5 *************** *** 48,52 **** // ! IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 217, 65 STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "About" --- 48,52 ---- // ! IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 215, 66 STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "About" *************** *** 55,62 **** CONTROL 133,IDC_BITZI,"Static",SS_BITMAP,6,11,46,18 LTEXT "Bitcollider/Windows Version ",IDC_VERSIONSTRING,57,10, ! 119,8,SS_NOPREFIX ! LTEXT "(PD) 2001 The Bitzi Corporation",IDC_STATIC,57,22,119,8 ! DEFPUSHBUTTON "OK",IDOK,180,11,30,11,WS_GROUP ! LTEXT "For more information about the Bitcollider and the Bitzi community metadatabase, please visit http://bitzi.com", IDC_STATIC,6,38,204,19 END --- 55,62 ---- CONTROL 133,IDC_BITZI,"Static",SS_BITMAP,6,11,46,18 LTEXT "Bitcollider/Windows Version ",IDC_VERSIONSTRING,57,10, ! 153,8,SS_NOPREFIX ! LTEXT "(PD) 2001 The Bitzi Corporation",IDC_STATIC,57,22,116,8 ! DEFPUSHBUTTON "OK",IDOK,174,20,36,13,WS_GROUP ! LTEXT "For more information about the Bitcollider and Bitzi's Free Universal Media Catalog, please visit http://bitzi.com", IDC_STATIC,6,38,204,19 END *************** *** 138,142 **** BEGIN RIGHTMARGIN, 210 ! BOTTOMMARGIN, 62 END --- 138,142 ---- BEGIN RIGHTMARGIN, 210 ! BOTTOMMARGIN, 63 END Index: main.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/main.c,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -r1.41 -r1.42 *** main.c 6 Jul 2002 09:30:15 -0000 1.41 --- main.c 24 Feb 2003 10:58:36 -0000 1.42 *************** *** 1,1211 **** ! /* (PD) 2001 The Bitzi Corporation ! * Please see file COPYING or http://bitzi.com/publicdomain ! * for more info. ! * ! * $Id$ ! */ ! /*------------------------------------------------------------------------- */ ! #include <stdio.h> ! #include <stdlib.h> ! #include <string.h> [...2393 lines suppressed...] ! char md5Hash[33]; ! ! MD5Init(&md5context); ! MD5Final(md5Digest, &md5context); ! bitziEncodeBase32(md5Digest, 16, md5Hash); ! ! if (strcmp(MD5_SANITY_CHECK_EMPTY, md5Hash)) ! return false; ! ! MD5Init(&md5context); ! MD5Update(&md5context, "01234", 5); ! MD5Final(md5Digest, &md5context); ! bitziEncodeBase32(md5Digest, 16, md5Hash); ! ! if (strcmp(MD5_SANITY_CHECK_01234, md5Hash)) ! return false; ! ! return true; ! } ! Index: tigertree.c =================================================================== RCS file: /cvsroot/bitcollider/bitcollider/lib/tigertree.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** tigertree.c 10 Sep 2001 21:13:18 -0000 1.6 --- tigertree.c 24 Feb 2003 10:58:36 -0000 1.7 *************** *** 42,46 **** { ctx->count = 0; ! ctx->index = 0; ctx->top = ctx->nodes; } --- 42,49 ---- { ctx->count = 0; ! ctx->leaf[0] = 0; // flag for leaf calculation -- never changed ! ctx->node[0] = 1; // flag for inner node calculation -- never changed ! ctx->block = ctx->leaf + 1 ; // working area for blocks ! ctx->index = 0; // partial block pointer/block length ctx->top = ctx->nodes; } *************** *** 48,52 **** static void tt_compose(TT_CONTEXT *ctx) { byte *node = ctx->top - NODESIZE; ! tiger((word64*)node,(word64)NODESIZE,(word64*)ctx->top); // combine two nodes #if USE_BIG_ENDIAN tt_endian((byte *)ctx->top); --- 51,56 ---- static void tt_compose(TT_CONTEXT *ctx) { byte *node = ctx->top - NODESIZE; ! memmove((ctx->node)+1,node,NODESIZE); // copy to scratch area ! tiger((word64*)(ctx->node),(word64)(NODESIZE+1),(word64*)(ctx->top)); // combine two nodes #if USE_BIG_ENDIAN tt_endian((byte *)ctx->top); *************** *** 56,64 **** } ! static void tt_block(TT_CONTEXT *ctx, byte *block) { word64 b; ! tiger((word64*)block,(word64)ctx->index,(word64*)ctx->top); #if USE_BIG_ENDIAN tt_endian((byte *)ctx->top); --- 60,68 ---- } ! static void tt_block(TT_CONTEXT *ctx) { word64 b; ! tiger((word64*)ctx->leaf,(word64)ctx->index+1,(word64*)ctx->top); #if USE_BIG_ENDIAN tt_endian((byte *)ctx->top); *************** *** 75,106 **** void tt_update(TT_CONTEXT *ctx, byte *buffer, word32 len) { if (ctx->index) ! { /* Try to fill partial block */ ! unsigned left = BLOCKSIZE - ctx->index; ! if (len < left) { ! memmove(ctx->block + ctx->index, buffer, len); ! ctx->index += len; ! return; /* Finished */ } ! else { ! memmove(ctx->block + ctx->index, buffer, left); ! ctx->index = BLOCKSIZE; ! tt_block(ctx, ctx->block); ! buffer += left; ! len -= left; } - } - while (len >= BLOCKSIZE) - { - ctx->index = BLOCKSIZE; - tt_block(ctx, buffer); - buffer += BLOCKSIZE; - len -= BLOCKSIZE; - } - if ((ctx->index = len)) /* This assignment is intended */ - /* Buffer leftovers */ - memmove(ctx->block, buffer, len); } --- 79,115 ---- void tt_update(TT_CONTEXT *ctx, byte *buffer, word32 len) { + if (ctx->index) ! { /* Try to fill partial block */ ! unsigned left = BLOCKSIZE - ctx->index; ! if (len < left) ! { ! memmove(ctx->block + ctx->index, buffer, len); ! ctx->index += len; ! return; /* Finished */ ! } ! else ! { ! memmove(ctx->block + ctx->index, buffer, left); ! ctx->index = BLOCKSIZE; ! tt_block(ctx); ! buffer += left; ! len -= left; ! } ! } ! ! while (len >= BLOCKSIZE) { ! memmove(ctx->block, buffer, BLOCKSIZE); ! ctx->index = BLOCKSIZE; ! tt_block(ctx); ! buffer += BLOCKSIZE; ! len -= BLOCKSIZE; } ! if ((ctx->index = len)) /* This assignment is intended */ { ! /* Buffer leftovers */ ! memmove(ctx->block, buffer, len); } } *************** *** 108,115 **** static void tt_final(TT_CONTEXT *ctx) { ! // do last partial block, unless index is zero // AND we're past the first block if((ctx->index>0)||(ctx->top==ctx->nodes)) ! tt_block(ctx,ctx->block); } --- 117,124 ---- static void tt_final(TT_CONTEXT *ctx) { ! // do last partial block, unless index is 1 (empty leaf) // AND we're past the first block if((ctx->index>0)||(ctx->top==ctx->nodes)) ! tt_block(ctx); } |