From:             
Operating system: 
PHP version:      Irrelevant
Package:          *Encryption and hash functions
Bug Type:         Feature/Change Request
Bug description:$offset parameter for md5_file() and sha1_file()

Description:
------------
There are some functions that calculate hash from a file, e.g., md5_file()
and sha1_file(), but they work only for whole files.



There's also a function (or a language construct?) __halt_compiler(), which
is useful for making "installers", as it allows to mix PHP code and binary
data (e.g., compressed archive) in a single file.



To make sure that whole "installer" is correctly downloaded, it would be
worth to validate checksum of binary data by comparing it with value of
checksum that is stored in PHP code part (i.e., before __halt_compiler()).
Currently, checksum of binary data may be calculated by fully loading
binary data and calling md5() or sha1() on a string. It is not a problem
for smaller installers, but if installer is larger (e.g., because of having
lots of images in it), it might require too much memory to be loaded into a
string. In this case, it would be handy to use md5_file() or sha1_file()
with 3rd parameter - $offset, something like md5_file($filename, false,
__COMPILER_HALT_OFFSET__).



Any chance to see it implemented some day?


-- 
Edit bug report at http://bugs.php.net/bug.php?id=54667&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54667&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54667&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54667&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54667&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54667&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54667&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54667&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54667&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54667&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54667&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54667&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54667&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54667&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54667&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54667&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54667&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54667&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54667&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54667&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54667&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54667&r=mysqlcfg

Reply via email to