File: tigertree.h

package info (click to toggle)
bitcollider 0.3.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,116 kB
  • ctags: 573
  • sloc: sh: 5,490; ansic: 4,805; cpp: 245; makefile: 109
file content (34 lines) | stat: -rw-r--r-- 1,178 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* (PD) 2001 The Bitzi Corporation
 * Please see file COPYING or http://bitzi.com/publicdomain 
 * for more info.
 *
 * $Id: tigertree.h,v 1.2 2001/04/03 23:53:49 mayhemchaos Exp $
 */
#include "tiger.h"

/* tiger hash result size, in bytes */
#define TIGERSIZE 24

/* size of each block independently tiger-hashed */
#define BLOCKSIZE 1024

/* size of input to each non-leaf hash-tree node */
#define NODESIZE TIGERSIZE*2

/* default size of interim values stack, in TIGERSIZE
 * blocks. If this overflows (as it will for input
 * longer than 2^64 in size), havoc may ensue. */
#define STACKSIZE TIGERSIZE*56

typedef struct tt_context {
  word64 count;                   /* total blocks processed */
  unsigned char block[BLOCKSIZE]; /* block in progress */
  int index;                      /* index into block */
  unsigned char *top;             /* top (next empty) stack slot */
  unsigned char nodes[STACKSIZE]; /* stack of interim node values */
} TT_CONTEXT;

void tt_init(TT_CONTEXT *ctx);
void tt_update(TT_CONTEXT *ctx, unsigned char *buffer, unsigned long len);
void tt_digest(TT_CONTEXT *ctx, unsigned char *hash);
void tt_copy(TT_CONTEXT *dest, TT_CONTEXT *src);