of static method
The hash of bytes, the content of path: SHA-256, with CRLF read as
LF for text files.
Implementation
static String of(String path, List<int> bytes) {
if (!isText(path)) return Sha256.hexOf(bytes);
final out = <int>[];
for (var i = 0; i < bytes.length; i++) {
if (bytes[i] == 0x0D && i + 1 < bytes.length && bytes[i + 1] == 0x0A) {
continue;
}
out.add(bytes[i]);
}
return Sha256.hexOf(out);
}