|
From: Gordon M. <go...@us...> - 2004-01-18 20:19:17
|
Update of /cvsroot/bitcollider/bitcollider/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv15794/lib
Modified Files:
kztree.c
Log Message:
* kztree.c
Better comment.
Index: kztree.c
===================================================================
RCS file: /cvsroot/bitcollider/bitcollider/lib/kztree.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** kztree.c 18 Jan 2004 10:59:54 -0000 1.1
--- kztree.c 18 Jan 2004 20:19:14 -0000 1.2
***************
*** 12,18 ****
* Networks, 2004-01-16.
*
! * Adapted to allow calculation in a stream fashion -- which
! * helps calculate several hashes with only one pass through
! * an input.
*
* NOTE: A tree hash value cannot be calculated using a
--- 12,53 ----
* Networks, 2004-01-16.
*
! * A compact description of the process given by that code:
! *
! * Break the file into N 32KB segments. If N>0, MD5 each segment
! * separately yielding N 16-byte hash values.
! *
! * While N>2: Concatenate each neighbor pair of hash values
! * together, using the empty array in lieu of a partner if
! * necessary for the last value. MD5 each of these segments
! * separately, giving (N+1)/2 16-byte hash values. Set N to
! * this new total.
! *
! * N is now 0, 1, or 2. Concatenate remaining hash values together
! * into a final segment. MD5 this segment to give the final value.
! *
! * Notable corner cases implied by the above:
! *
! * For the zero-length input, the kztree value is the same as
! * the MD5 value.
! *
! * For input with length up to 32,768, the kztree value is the
! * MD5 of the MD5 of the input.
! *
! * Notable differences from THEX/TigerTree:
! *
! * (1) Leaf blocks are 32KB in kzhash rather than 1KB.
! * (2) In kzhash, internal values with no sibling are rehashed,
! * rather than promoted to the parent position unchanged as
! * in THEX.
! * (3) Kzhash does not use a prefix byte to differentiate
! * between leaf and inner-node hashes.
! * (3) In kzhash, a file <= a single leaf block is hashed, then
! * hashed again, preventing a trivial collision problem.
! * (THEX/TigerTree uses the leaf/node prefix bytes to
! * prevent the collision.)
! *
! * The approach used here has been adapted to allow calculation in a
! * stream fashion -- which helps eliminate the need for multiple
! * passes through a file when calculating several hashes at once.
*
* NOTE: A tree hash value cannot be calculated using a
|