\Omega\Filesystem\Util Checksum

Class Checksum.

The Checksum class provides utility methods for calculating MD5 checksums for both strings and files. This class is designed to facilitate the verification of data integrity by allowing users to generate checksums that can be used to identify changes or ensure the consistency of file contents. It encapsulates the functionality to compute checksums in a straightforward manner, making it easy to use in various applications dealing with file storage and data management.

Summary

Methods
Properties
Constants
fromContent
fromFile
No public properties found
No public constants found
No protected methods found
No protected properties found
No protected constants found
No private methods found
No private properties found
No private constants found

Methods

fromContent()

fromContent(string  $content) : string

Calculates the MD5 checksum of the provided content.

This method takes a string as input and computes its MD5 checksum. The resulting checksum can be used to verify data integrity or detect changes in the content.

Parameters

string $content

The content for which to calculate the checksum.

Returns

string —

The MD5 checksum of the given content.

fromFile()

fromFile(string  $filename) : string

Calculates the MD5 checksum of the specified file.

This method reads the specified file and computes its MD5 checksum. The checksum can be used for file integrity checks to ensure that the content has not been altered since the checksum was generated.

Parameters

string $filename

The path to the file for which to calculate the checksum.

Throws

\RuntimeException

If the file cannot be read.

Returns

string —

The MD5 checksum of the specified file.