1 #ifndef PHP_HTTP_ETAG_H
2 #define PHP_HTTP_ETAG_H
4 PHP_HTTP_API
void *php_http_etag_init(TSRMLS_D
);
5 PHP_HTTP_API
size_t php_http_etag_update(void *ctx
, const char *data_ptr
, size_t data_len TSRMLS_DC
);
6 PHP_HTTP_API
char *php_http_etag_finish(void *ctx TSRMLS_DC
);
8 static inline char *php_http_etag_digest(const unsigned char *digest
, int len
)
10 static const char hexdigits
[17] = "0123456789abcdef";
12 char *hex
= emalloc(len
* 2 + 1);
15 for (i
= 0; i
< len
; ++i
) {
16 *ptr
++ = hexdigits
[digest
[i
] >> 4];
17 *ptr
++ = hexdigits
[digest
[i
] & 0xF];
24 #endif /* PHP_HTTP_ETAG_H */