How to find crc32 of big files?

Arshdeep picture Arshdeep · Jun 5, 2010 · Viewed 7.2k times · Source

The PHP's crc32 support string as input.And For a file , below code will work OFC.

crc32(file_get_contents("myfile.CSV"));

But if file goes huge (2 GB) it might raise out of memory Fatal error.

So any way around to find checksum of huge files ?

Answer

dev-null-dweller picture dev-null-dweller · Jun 5, 2010

PHP doesn't support files larger than 2GB (32bit limitation)

And more efficient way to calculate crc32 from files:

$hash = hash_file('crc32b',"myfile.CSV" );