Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

tigertree.c File Reference


Detailed Description

Implementation of the TigerTree algorithm.

Patterned after sha.c by A.M. Kuchling and others.

To use:

  1. allocate a TTH_CONTEXT in your own code;
  2. tt_init(ttctx);
  3. tt_update(ttctx, buffer, length); as many times as necessary
  4. tt_digest(ttctx,resultptr);

Requires the tiger() function as defined in the reference implementation provided by the creators of the Tiger algorithm. See

http://www.cs.technion.ac.il/~biham/Reports/Tiger/

#include "common.h"
#include "base32.h"
#include "endian.h"
#include "misc.h"
#include "tigertree.h"
#include "override.h"

Data Structures

struct  TTH_CONTEXT

Defines

#define TTH_NODESIZE   (TIGERSIZE * 2)
#define TTH_STACKSIZE   (TIGERSIZE * 56)
#define D(x)   x x
#define Ax1024   D(D(D(D(D(D(D(D(D(D("A"))))))))))
#define Ax1025   Ax1024 "A"

Enumerations

enum  { TTH_F_INITIALIZED = 1 << 0, TTH_F_FINISHED = 1 << 1 }

Functions

filesize_t tt_block_count (filesize_t filesize)
unsigned tt_full_depth (filesize_t filesize)
unsigned tt_good_depth (filesize_t filesize)
filesize_t tt_good_slice_size (filesize_t filesize)
filesize_t tt_node_count_at_depth (filesize_t filesize, unsigned depth)
size_t tt_good_node_count (filesize_t filesize)
filesize_t tt_blocks_per_leaf (filesize_t filesize)
void tt_internal_hash (const struct tth *a, const struct tth *b, struct tth *dst)
void tt_compose (TTH_CONTEXT *ctx)
void tt_collapse (TTH_CONTEXT *ctx)
void tt_block (TTH_CONTEXT *ctx)
void tt_finish (TTH_CONTEXT *ctx)
size_t tt_compute_parents (struct tth *dst, const struct tth *src, size_t src_leaves)
tth tt_root_hash (const struct tth *src, size_t n_leaves)
void tt_init (TTH_CONTEXT *ctx, filesize_t filesize)
void tt_update (TTH_CONTEXT *ctx, const void *data, size_t size)
void tt_digest (TTH_CONTEXT *ctx, struct tth *hash)
size_t tt_size (void)
const struct tthtt_leaves (TTH_CONTEXT *ctx)
size_t tt_leave_count (TTH_CONTEXT *ctx)
void tt_check (void)
 Runs some test cases to check whether the implementation is alright.


Define Documentation

#define Ax1024   D(D(D(D(D(D(D(D(D(D("A"))))))))))
 

#define Ax1025   Ax1024 "A"
 

#define D  )     x x
 

#define TTH_NODESIZE   (TIGERSIZE * 2)
 

#define TTH_STACKSIZE   (TIGERSIZE * 56)
 


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
TTH_F_INITIALIZED 
TTH_F_FINISHED 


Function Documentation

void tt_block TTH_CONTEXT ctx  )  [static]
 

filesize_t tt_block_count filesize_t  filesize  ) 
 

filesize_t tt_blocks_per_leaf filesize_t  filesize  )  [static]
 

void tt_check void   ) 
 

Runs some test cases to check whether the implementation is alright.

void tt_collapse TTH_CONTEXT ctx  )  [static]
 

void tt_compose TTH_CONTEXT ctx  )  [static]
 

size_t tt_compute_parents struct tth dst,
const struct tth src,
size_t  src_leaves
 

Parameters:
dst must be (src_leaves + 1) / 2 elements large.
src the nodes to compute the parents for.
src_leaves the number of 'src' nodes. return The number of parents.

void tt_digest TTH_CONTEXT ctx,
struct tth hash
 

void tt_finish TTH_CONTEXT ctx  )  [static]
 

unsigned tt_full_depth filesize_t  filesize  ) 
 

unsigned tt_good_depth filesize_t  filesize  ) 
 

size_t tt_good_node_count filesize_t  filesize  ) 
 

filesize_t tt_good_slice_size filesize_t  filesize  ) 
 

void tt_init TTH_CONTEXT ctx,
filesize_t  filesize
 

void tt_internal_hash const struct tth a,
const struct tth b,
struct tth dst
[static]
 

size_t tt_leave_count TTH_CONTEXT ctx  ) 
 

const struct tth* tt_leaves TTH_CONTEXT ctx  ) 
 

filesize_t tt_node_count_at_depth filesize_t  filesize,
unsigned  depth
 

struct tth tt_root_hash const struct tth src,
size_t  n_leaves
 

size_t tt_size void   ) 
 

void tt_update TTH_CONTEXT ctx,
const void *  data,
size_t  size
 


Generated on Sat Jun 30 17:53:31 2007 for gtk-gnutella by  doxygen 1.3.9.1