- if (mode && (eho = php_hash_fetch_ops(mode, strlen(mode)))) {
- eho->hash_final(digest, ctx);
- etag = php_http_etag_digest(digest, eho->digest_size);
- } else
-#endif
- if (mode && ((!strcasecmp(mode, "crc32")) || (!strcasecmp(mode, "crc32b")))) {
- *((uint *) ctx) = ~*((uint *) ctx);
- etag = php_http_etag_digest((const unsigned char *) ctx, sizeof(uint));
- } else if (mode && (!strcasecmp(mode, "sha1"))) {
- PHP_SHA1Final(digest, ctx);
+ *((uint *) e->ctx) = ~*((uint *) e->ctx);
+ buf[0] = ((unsigned char *) e->ctx)[3];
+ buf[1] = ((unsigned char *) e->ctx)[2];
+ buf[2] = ((unsigned char *) e->ctx)[1];
+ buf[3] = ((unsigned char *) e->ctx)[0];
+ etag = php_http_etag_digest(buf, 4);
+ } else if ((!strcasecmp(e->mode, "sha1"))) {
+ PHP_SHA1Final(digest, e->ctx);