2005-06-27 11:27:56 +08:00
|
|
|
#ifndef CSUM_FILE_H
|
|
|
|
#define CSUM_FILE_H
|
|
|
|
|
|
|
|
/* A SHA1-protected file */
|
|
|
|
struct sha1file {
|
|
|
|
int fd, error;
|
2005-06-27 13:01:46 +08:00
|
|
|
unsigned int offset, namelen;
|
2005-06-27 11:27:56 +08:00
|
|
|
SHA_CTX ctx;
|
2005-06-27 13:01:46 +08:00
|
|
|
char name[PATH_MAX];
|
2005-06-27 11:27:56 +08:00
|
|
|
unsigned char buffer[8192];
|
|
|
|
};
|
|
|
|
|
2005-06-29 02:10:06 +08:00
|
|
|
extern struct sha1file *sha1fd(int fd, const char *name);
|
2005-08-09 23:30:22 +08:00
|
|
|
extern struct sha1file *sha1create(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
|
2005-06-27 13:01:46 +08:00
|
|
|
extern int sha1close(struct sha1file *, unsigned char *, int);
|
2005-06-27 11:27:56 +08:00
|
|
|
extern int sha1write(struct sha1file *, void *, unsigned int);
|
|
|
|
extern int sha1write_compressed(struct sha1file *, void *, unsigned int);
|
|
|
|
|
|
|
|
#endif
|