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 ?
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 ?
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" );
This function in the User Contributed Notes to crc32() claims to calculate the value without loading the file in full. If it works correctly, it should eliminate any memory problems.
For a file larger than 2 GB, it is however likely to stop at the same 32-bit limitation you are encountering right now.
If possible, I would invoke an external tool that can calculate the checksum for files as large as the one at hand.