readChecksumLine.php
Table of Contents
Functions
- readChecksumLine() : string|null
- Reads the checksum a checksum file records for one file, or null.
Functions
readChecksumLine()
Reads the checksum a checksum file records for one file, or null.
readChecksumLine(string $content, string $filename[, string $algorithm = 'sha256' ]) : string|null
Read as sha256sum writes it, see checksumLine(): the hash, then two spaces — or a space
and a star, its binary mode — then the file name. The hash must have the length of the
algorithm's (64 characters for sha256, 32 for md5). Only a line naming this file counts: a
checksum file copied beside the wrong file must not vouch for it. A file listing several files
is read line by line, and the first line naming this one is taken.
Parameters
- $content : string
-
What the checksum file holds.
- $filename : string
-
The name of the file, as the line writes it.
- $algorithm : string = 'sha256'
-
A hashing algorithm supported by hash_algos() (default:
'sha256').
Tags
Return values
string|null —The hash, lowercase; null when no line names the file with a well-formed one.