blob: 776cfb152af2b6c4fb6c190d875b4fb2f9162c9a [file] [log] [blame]
Linus Torvaldsc38138c2005-06-26 20:27:56 -07001#ifndef CSUM_FILE_H
2#define CSUM_FILE_H
3
4/* A SHA1-protected file */
5struct sha1file {
6 int fd, error;
Linus Torvaldse1808842005-06-26 22:01:46 -07007 unsigned int offset, namelen;
Linus Torvaldsc38138c2005-06-26 20:27:56 -07008 SHA_CTX ctx;
Linus Torvaldse1808842005-06-26 22:01:46 -07009 char name[PATH_MAX];
Linus Torvaldsc38138c2005-06-26 20:27:56 -070010 unsigned char buffer[8192];
11};
12
Linus Torvalds4397f012005-06-28 11:10:06 -070013extern struct sha1file *sha1fd(int fd, const char *name);
Linus Torvaldsc38138c2005-06-26 20:27:56 -070014extern struct sha1file *sha1create(const char *fmt, ...);
Linus Torvaldse1808842005-06-26 22:01:46 -070015extern int sha1close(struct sha1file *, unsigned char *, int);
Linus Torvaldsc38138c2005-06-26 20:27:56 -070016extern int sha1write(struct sha1file *, void *, unsigned int);
17extern int sha1write_compressed(struct sha1file *, void *, unsigned int);
18
19#endif