SmartPDF - lightweight pdf viewer app for rosapps
[reactos.git] / rosapps / smartpdf / fitz / include / fitz / stm_crypt.h
1 /*
2 * Basic crypto functions.
3 * Independent of the rest of fitz.
4 * For further encapsulation in filters, or not.
5 */
6
7 /* crc-32 checksum */
8
9 unsigned long fz_crc32(unsigned long crc, unsigned char *buf, int len);
10
11 /* md5 digests */
12
13 typedef struct fz_md5_s fz_md5;
14
15 struct fz_md5_s
16 {
17 unsigned long state[4];
18 unsigned long count[2];
19 unsigned char buffer[64];
20 };
21
22 void fz_md5init(fz_md5 *state);
23 void fz_md5update(fz_md5 *state, unsigned char *input, unsigned inlen);
24 void fz_md5final(fz_md5 *state, unsigned char digest[16]);
25
26 /* arc4 crypto */
27
28 typedef struct fz_arc4_s fz_arc4;
29
30 struct fz_arc4_s
31 {
32 unsigned x;
33 unsigned y;
34 unsigned char state[256];
35 };
36
37 void fz_arc4init(fz_arc4 *state, unsigned char *key, unsigned len);
38 unsigned char fz_arc4next(fz_arc4 *state);
39 void fz_arc4encrypt(fz_arc4 *state, unsigned char *dest, unsigned char *src, unsigned len);
40
41 /* TODO: sha1 */
42 /* TODO: aes */
43