Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions InertiaCore/Extensions/InertiaExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using System.Text;
using System.IO.Hashing;

namespace InertiaCore.Extensions;

Expand Down Expand Up @@ -51,11 +52,10 @@ internal static bool Override<TKey, TValue>(this IDictionary<TKey, TValue> 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)
Expand Down
1 change: 1 addition & 0 deletions InertiaCore/InertiaCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

<ItemGroup>
<PackageReference Include="System.IO.Abstractions" Version="19.2.16" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="TypeMerger" Version="2.1.1" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion InertiaCore/Utils/Vite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,5 @@ public static class Vite
/// <summary>
/// Generate the Manifest hash.
/// </summary>
public static string? GetManifestHash() => _instance.GetManifest()?.MD5();
public static string? GetManifestHash() => _instance.GetManifest()?.XXH128();
}
2 changes: 1 addition & 1 deletion InertiaCoreTests/UnitTestVite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public async Task TestViteVersion()
Assert.That(result, Is.InstanceOf<JsonResult>());

var json = (result as JsonResult)?.Value;
Assert.That((json as Page)?.Version, Is.EqualTo("bba1afd1066309f4a69430e0c446ba8d"));
Assert.That((json as Page)?.Version, Is.EqualTo("24a5fa185351b781e5eb6f813c433180"));
});
}
}