From a60f761ab76e32da71ef5d429459cac1c293216e Mon Sep 17 00:00:00 2001 From: Robert Boes <2871897+RobertBoes@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:57:50 +0200 Subject: [PATCH 1/2] Replace md5 with xxhash --- src/Middleware.php | 6 +++--- tests/ResponseFactoryTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Middleware.php b/src/Middleware.php index 24caf9ad..ba4d9a34 100644 --- a/src/Middleware.php +++ b/src/Middleware.php @@ -29,15 +29,15 @@ class Middleware public function version(Request $request) { if (config('app.asset_url')) { - return md5(config('app.asset_url')); + return hash('xxh128', config('app.asset_url')); } if (file_exists($manifest = public_path('mix-manifest.json'))) { - return md5_file($manifest); + return hash_file('xxh128', $manifest); } if (file_exists($manifest = public_path('build/manifest.json'))) { - return md5_file($manifest); + return hash_file('xxh128', $manifest); } return null; diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index 50d2c78b..465539da 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -109,7 +109,7 @@ public function test_the_version_can_be_a_closure(): void $this->assertSame('', Inertia::getVersion()); Inertia::version(function () { - return md5('Inertia'); + return hash('xxh128', 'Inertia'); }); return Inertia::render('User/Edit'); From 61b1c89f5ff9743ec1dbd49b9834b61d8d89633e Mon Sep 17 00:00:00 2001 From: Robert Boes <2871897+RobertBoes@users.noreply.github.com> Date: Fri, 9 Aug 2024 15:35:54 +0200 Subject: [PATCH 2/2] Update the hash value for "Inertia" --- tests/ResponseFactoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ResponseFactoryTest.php b/tests/ResponseFactoryTest.php index 465539da..ba1bd91a 100644 --- a/tests/ResponseFactoryTest.php +++ b/tests/ResponseFactoryTest.php @@ -117,7 +117,7 @@ public function test_the_version_can_be_a_closure(): void $response = $this->withoutExceptionHandling()->get('/', [ 'X-Inertia' => 'true', - 'X-Inertia-Version' => 'b19a24ee5c287f42ee1d465dab77ab37', + 'X-Inertia-Version' => 'f445bd0a2c393a5af14fc677f59980a9', ]); $response->assertSuccessful();