Codulle - L'explorateur de code sources
Informations fichier
Nom du fichier : OMcrc32.phpTaille du fichier : 2 Ko (73 lignes)
Language : PHP
span style="color: #808080; font-style: italic;">/* * CRC32 calculation for big files : avoids loading whole file in RAM * * Author/Copyright : Olivier MATHERET * matheret@free.fr http://matheret.free.fr * Licenced under CeCILL2 * * Based on : * Reverse CRC adapted from "Reversing CRC – Theory and Practice" * HU Berlin Public Report * Martin Stigge, Henryk Plotz, Wolf Muller, Jens-Peter Redlich * */ /** * Gives 4 bytes so that it afterwards will compute to the given crc * * This function uses the method of the multiplication with (x^N)^ -1. */// calculate crc except for the last 4 bytes ; this is essentially crc32 ()*/ $crcreg = 0xffffffff ; // calculate new content bits // new_content = tcrcreg * CRCINV mod CRCPOLY // reduce modulo CRCPOLY // add CRCINV if corresponding bit of operand is set // return new content $buffer = ""/* Calculates the CRC32 of the given file without loading the file in RAM at once */'rb'""