Skip to content

Commit bf58d21

Browse files
authored
Replace MD5 with xxh128 in File::hasSameHash() (#54690)
Drop-in replacement. Much faster than MD5, and avoids its security issues.
1 parent 4405e13 commit bf58d21

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Illuminate/Filesystem/Filesystem.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,9 @@ public function isWritable($path)
547547
*/
548548
public function hasSameHash($firstFile, $secondFile)
549549
{
550-
$hash = @md5_file($firstFile);
550+
$hash = @hash_file('xxh128', $firstFile);
551551

552-
return $hash && hash_equals($hash, (string) @md5_file($secondFile));
552+
return $hash && hash_equals($hash, (string) @hash_file('xxh128', $secondFile));
553553
}
554554

555555
/**

0 commit comments

Comments
 (0)