1 #ifndef PHP_HTTP_ETAG_H
2 #define PHP_HTTP_ETAG_H
4 typedef struct php_http_etag
{
13 PHP_HTTP_API php_http_etag_t
*php_http_etag_init(const char *mode TSRMLS_DC
);
14 PHP_HTTP_API
size_t php_http_etag_update(php_http_etag_t
*e
, const char *data_ptr
, size_t data_len
);
15 PHP_HTTP_API
char *php_http_etag_finish(php_http_etag_t
*e
);
17 static inline char *php_http_etag_digest(const unsigned char *digest
, int len
)
19 static const char hexdigits
[17] = "0123456789abcdef";
21 char *hex
= emalloc(len
* 2 + 1);
24 for (i
= 0; i
< len
; ++i
) {
25 *ptr
++ = hexdigits
[digest
[i
] >> 4];
26 *ptr
++ = hexdigits
[digest
[i
] & 0xF];
33 #endif /* PHP_HTTP_ETAG_H */