diff --git a/InertiaCore/Extensions/InertiaExtensions.cs b/InertiaCore/Extensions/InertiaExtensions.cs index 192b424..1b052ed 100644 --- a/InertiaCore/Extensions/InertiaExtensions.cs +++ b/InertiaCore/Extensions/InertiaExtensions.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using System.Text; +using System.IO.Hashing; namespace InertiaCore.Extensions; @@ -51,11 +52,10 @@ internal static bool Override(this IDictionary dicti return result?.GetValue(task); } - internal static string MD5(this string s) + internal static string XXH128(this string s) { - using var md5 = System.Security.Cryptography.MD5.Create(); var inputBytes = Encoding.UTF8.GetBytes(s); - var hashBytes = md5.ComputeHash(inputBytes); + var hashBytes = XxHash128.Hash(inputBytes); var sb = new StringBuilder(); foreach (var t in hashBytes) diff --git a/InertiaCore/InertiaCore.csproj b/InertiaCore/InertiaCore.csproj index 5f68508..3ed40a6 100644 --- a/InertiaCore/InertiaCore.csproj +++ b/InertiaCore/InertiaCore.csproj @@ -22,6 +22,7 @@ + diff --git a/InertiaCore/Utils/Vite.cs b/InertiaCore/Utils/Vite.cs index 8e294c4..105372f 100644 --- a/InertiaCore/Utils/Vite.cs +++ b/InertiaCore/Utils/Vite.cs @@ -247,5 +247,5 @@ public static class Vite /// /// Generate the Manifest hash. /// - public static string? GetManifestHash() => _instance.GetManifest()?.MD5(); + public static string? GetManifestHash() => _instance.GetManifest()?.XXH128(); } diff --git a/InertiaCoreTests/UnitTestVite.cs b/InertiaCoreTests/UnitTestVite.cs index 9dde8df..9b9bf19 100644 --- a/InertiaCoreTests/UnitTestVite.cs +++ b/InertiaCoreTests/UnitTestVite.cs @@ -249,7 +249,7 @@ public async Task TestViteVersion() Assert.That(result, Is.InstanceOf()); var json = (result as JsonResult)?.Value; - Assert.That((json as Page)?.Version, Is.EqualTo("bba1afd1066309f4a69430e0c446ba8d")); + Assert.That((json as Page)?.Version, Is.EqualTo("24a5fa185351b781e5eb6f813c433180")); }); } }