Hash
If you need to obtain a hash of the stream's content, then use the hash()
method.
The method accepts a number of arguments;
string $algo
: Name of the hashing algorithm to be used.bool $binary
: (optional) Iftrue
, outputs raw binary data.int $flags
: (optional) Optional settings for hash generationstring $key
: (optional) Shared secret key, whenHASH_HMAC
specified in$flags
array $options
: (optional) Options for the specified hashing algorithm
$stream = FileStream::open('persons.txt', 'rb');
echo $stream->hash('crc32'); // d5aad468
For additional information, please review PHP documentation: