PHP Classes
elePHPant
Icontem

PHP File Integrity Check: Check if directory files change using MD5 hashes

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2014-05-02 (2 years ago) RSS 2.0 feedStarStarStarStarStar 80%Total: 438 This week: 1All time: 5,932 This week: 958Up
Version License PHP version Categories
file-integrity-check 1.6GNU General Publi...5.3PHP 5, Files and Folders, Security
Description Author

This class can check if directory files change using MD5 hashes.

It can traverse a given directory to get the files list and computes the MD5 hashes of each file.

The list of file names and hashes are stored in a given file.

The class can also verify if the directory files changed by comparing previously stored hashes with current directory files hashes.

It returns a list of files that were changed, added or removed.

Picture of Unay Santisteban
  Performance   Level  
Name: Unay Santisteban is available for providing paid consulting. Contact Unay Santisteban .
Classes: 4 packages by
Country: Spain Spain
Age: 27
All time rank: 87019 in Spain Spain
Week rank: 152 Up4 in Spain Spain Up
Innovation award
Innovation award
Nominee: 1x

Details
integrity-md5-class
===================

Comprueba los hashes MD5 de un árbol de directorios para ver si han sido modificados.

Uso
===

Podemos generar un archivo de hashes MD5 usando el metodo *getMD5Hashes()* este metodo generara un archivo con la fecha actual si no se especifica el nombre del archivo.

```php
include 'libraries/integrity.md5.class.php';
$integrity = new integrity('path/to/folder/');
$integrity->getMD5Hashes(); // archivo por defecto, por ejemplo: 20140316151603.md5
// or
$integrity->getMD5Hashes('custom_name.md5'); // archivo personalizado.
```

Para realizar la comprobacion debemos usar el metodo *checkMD5Hashes()* al cual le pasaremos el archivo con los hashes MD5 con los que deseemos realizar la comparacion.

```php
include 'libraries/integrity.md5.class.php';
$integrity = new integrity('path/to/folder/');
$files = $integrity->checkMD5Hashes();
var_dump($files);
```
Nos devolvera un array con la lista de los archivos que an sufrido cambios.

  Files folder image Files  
File Role Description
Accessible without login Plain text file checkMD5.php Example Aux
Accessible without login Plain text file generateMD5.php Example Aux
Plain text file integrity.md5.class.php Class Main Class
Accessible without login Plain text file LICENSE Lic. Licence
Accessible without login Plain text file README.md Doc. ReadMe

 Version Control Reuses Unique User Downloads Download Rankings  
 100%1
Total:438
This week:1
All time:5,932
This week:958Up
User Ratings User Comments (1)
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:100%StarStarStarStarStarStar
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:80%StarStarStarStarStar
Rank:16
 
This is a good and useful class ;-)
2 years ago (JosÚ Filipe Lopes Santos)
80%StarStarStarStarStar