Online Shopping : Computers : Programming : Languages : PHP : Common Problems : Encryption

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 25 people (48%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

What is the fastest way to get the MD5 checksum of a file?

May 14th, 2000 18:11
Nathan Wallace, Nathan Benson, Richard Lynch


You could use 'md5sum' through a system/exec call.

  (phuzz:tdp-ws--00 ~)$ md5sum lynx_bookmarks.html
  62cb158904a682847c4625d556e3843f  lynx_bookmarks.html
  (phuzz:tdp-ws--00 ~)$

See the exec() function in the manual.

The file would have to be pretty big before the speed of exec() would be
faster than the speed of fopen/fread(,1000000)/fclose though...

Run some tests on varying sizes of sample files on your server and see
where the breakpoint is before you get too carried away.