mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
checksum: Don't read the entire input file in memory
Unsurprisingly, this doesn't work too well if the input file is in the gigabyte range.
This commit is contained in:
parent
eea5a5ed5d
commit
67f01fd82e
1 changed files with 3 additions and 1 deletions
|
@ -85,7 +85,9 @@ int main(int argc, char** argv)
|
|||
has_error = true;
|
||||
continue;
|
||||
}
|
||||
hash.update(file->read_all());
|
||||
|
||||
while (!file->eof() && !file->has_error())
|
||||
hash.update(file->read(PAGE_SIZE));
|
||||
auto digest = hash.digest();
|
||||
auto digest_data = digest.immutable_data();
|
||||
StringBuilder builder;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue