Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

footprint.cc File Reference

#include "footprint.h"
#include <sys/types.h>
#include <string.h>
#include <assert.h>

Include dependency graph for footprint.cc:

Include dependency graph

Go to the source code of this file.

Defines

#define COMPUTE(var, ch)   (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]

Functions

long crc (char *s)
 returns crc of string

long crc (char *s, int len)
 returns crc of char array

void cksumblock (FILE *file, u_int32_t &crc)
 checksum block of 512 chars from file

char * encode (u_int32_t v)
 encode a u_int32_t base64

char * footprint (FILE *file)
 
Id
footprint.h,v 1.3 2003/12/29 18:06:31 stoerr Exp
returns a footprint of the file.

double footPrintDiff (const char *f1, const char *f2)
 returns equivalence percentage of two footprints


Variables

const u_int32_t crctab []
 footprint.cc -*- c++ -*- Hans-Peter Stoerr Tue Nov 11 2003 Generate footprints of a (large) file that are designed to be hopefully unique, but are easy to calculate and not changed much if some blocks are destroyed in the file.

char basis_64 []


Define Documentation

#define COMPUTE var,
ch   )     (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)]
 

Definition at line 70 of file footprint.cc.

Referenced by cksumblock(), and crc().


Function Documentation

void cksumblock FILE *  file,
u_int32_t &  crc
 

checksum block of 512 chars from file

Definition at line 89 of file footprint.cc.

References COMPUTE, and crc().

Referenced by footprint().

Here is the call graph for this function:

long crc char *  s,
int  len
 

returns crc of char array

Definition at line 81 of file footprint.cc.

References COMPUTE.

Referenced by readheader(), and writeheader().

long crc char *  s  ) 
 

returns crc of string

Definition at line 73 of file footprint.cc.

Referenced by cksumblock().

char* encode u_int32_t  v  ) 
 

encode a u_int32_t base64

Definition at line 100 of file footprint.cc.

References basis_64.

Referenced by footprint().

char* footprint FILE *  file  ) 
 

Id
footprint.h,v 1.3 2003/12/29 18:06:31 stoerr Exp
returns a footprint of the file.

footprint is as follows: cksum of first 5 blocks, cksum of last 5 blocks, take 15 blocks equally spaced from the rest of the file and cksum first 5, next 5 and last 5 current length: 32 chars

Definition at line 119 of file footprint.cc.

References cksumblock(), and encode().

Referenced by correctfile(), main(), and protectfile().

Here is the call graph for this function:

double footPrintDiff const char *  f1,
const char *  f2
 

returns equivalence percentage of two footprints

Definition at line 158 of file footprint.cc.

Referenced by correctfile().


Variable Documentation

char basis_64[] [static]
 

Initial value:

   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 96 of file footprint.cc.

Referenced by encode().

const u_int32_t crctab[] [static]
 

footprint.cc -*- c++ -*- Hans-Peter Stoerr Tue Nov 11 2003 Generate footprints of a (large) file that are designed to be hopefully unique, but are easy to calculate and not changed much if some blocks are destroyed in the file.

Purpose of the footprint is a sanity check whether we are applying error correction to the same file.

Id
footprint.cc,v 1.6 2003/12/29 18:06:31 stoerr Exp

Definition at line 15 of file footprint.cc.


Generated on Tue Dec 30 12:07:36 2003 for ErrorProtect by doxygen 1.3.2