- if (!strcasecmp(e->mode, "crc32b")) {
- uint e_ctx;
- memcpy(&e_ctx, e->ctx, 4);
- e_ctx = ntohl(~e_ctx);
- etag = php_http_etag_digest((unsigned char *) &e_ctx, 4);
- } else if ((!strcasecmp(e->mode, "sha1"))) {
- PHP_SHA1Final(digest, e->ctx);
- etag = php_http_etag_digest(digest, 20);
- } else if ((!strcasecmp(e->mode, "md5"))) {
- PHP_MD5Final(digest, e->ctx);
- etag = php_http_etag_digest(digest, 16);
- } else {
-#if PHP_HTTP_HAVE_HASH
- const php_hash_ops *eho = NULL;
-
- if ((eho = php_hash_fetch_ops(e->mode, strlen(e->mode)))) {
- eho->hash_final(digest, e->ctx);
- etag = php_http_etag_digest(digest, eho->digest_size);
- }
-#endif
- }
-
- efree(e->ctx);
- efree(e->mode);
+ e->ops->hash_final(digest, e->ctx);
+ etag = php_http_etag_digest(digest, e->ops->digest_size);