Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:11914 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65161 invoked by uid 1010); 4 Aug 2004 15:16:49 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 65081 invoked from network); 4 Aug 2004 15:16:48 -0000 Received: from unknown (HELO mail012.syd.optusnet.com.au) (211.29.132.66) by pb1.pair.com with SMTP; 4 Aug 2004 15:16:48 -0000 Received: from [192.168.0.4] (c210-49-173-207.brasd1.vic.optusnet.com.au [210.49.173.207]) (authenticated) by mail012.syd.optusnet.com.au (8.11.6p2/8.11.6) with ESMTP id i74FGbd17586; Thu, 5 Aug 2004 01:16:37 +1000 Message-ID: <4110FDD4.2060106@php.net> Date: Thu, 05 Aug 2004 01:16:36 +1000 Reply-To: dave@php.net User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707) X-Accept-Language: en-us, en MIME-Version: 1.0 To: ilia@prohost.org CC: internals@lists.php.net References: <20040804145657.GA15294@astrid.santinoli.com> <200408041108.22045.ilia@prohost.org> In-Reply-To: <200408041108.22045.ilia@prohost.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] Passthrough MD5/SHA1 calculation of uploaded files From: dave@php.net (Dave) Ilia Alshanetsky wrote: > -1 it seems somewhat redundant given that this signature can be easily > generated via a single function call, md5_file() or sha1_file(). > > Ilia > I think his point was that the hash is calculated as the file is being uploaded, which saves having to read the whole file a second time after uploading is finished. For big files, and repetitious uploading, this could probably save on the CPU cycles and I/O load a bit. I'd like to see an ini setting to disable this, though. Dave > On August 4, 2004 10:56 am, David Santinoli wrote: > >>Hi, >> I'm submitting a patch to perform "on the fly" MD5/SHA1 digest >>calculation of a file uploaded via the HTTP POST method. Being >>not uncommon for applications to require some digest of a freshly >>uploaded file, doing the math directly in the buffer where the file is >>being read can save some time. >> >>Digest calculation is triggered by setting the special input fields >>COMPUTE_MD5 and/or COMPUTE_SHA1 to a non-zero value: >> >> >> >>(note that these assignments must precede the >> field, as in the MAX_FILE_SIZE case.) >> >>The result is found in the special variables >>$_FILES[userfile]["md5"] and $_FILES[userfile]["sha1"]. >>These variables are only defined upon request of the corresponding >>digest. >> >>The patch was produced against the current CVS version of rfc1867.c >>(PHP_5_0 branch, v1.160). >> >>Cheers, >> David > >