-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wasm SDK packed as a nuget package (#31519)
Co-authored-by: Larry Ewing <[email protected]> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c1683d6
commit 7fdf9a6
Showing
24 changed files
with
104 additions
and
21,385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
using System.Numerics; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Microsoft.AspNetCore.StaticWebAssets.Tasks; | ||
|
||
public static class FileHasher | ||
{ | ||
public static string GetFileHash(string filePath) | ||
{ | ||
using var hash = SHA256.Create(); | ||
var bytes = Encoding.UTF8.GetBytes(filePath); | ||
var hashBytes = hash.ComputeHash(bytes); | ||
return ToBase36(hashBytes); | ||
} | ||
|
||
private static string ToBase36(byte[] hash) | ||
{ | ||
const string chars = "0123456789abcdefghijklmnopqrstuvwxyz"; | ||
|
||
var result = new char[10]; | ||
var dividend = BigInteger.Abs(new BigInteger(hash.AsSpan().Slice(0, 9).ToArray())); | ||
for (var i = 0; i < 10; i++) | ||
{ | ||
dividend = BigInteger.DivRem(dividend, 36, out var remainder); | ||
result[i] = chars[(int)remainder]; | ||
} | ||
|
||
return new string(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 0 additions & 83 deletions
83
src/Tests/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/ComputeBlazorBuildAssetsTest.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.