From 177e708932f71da7f75148b3d2eb250f1418c1ab Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Thu, 16 Jun 2022 21:23:02 +0300 Subject: [PATCH 1/2] Target .NET 6, use `[SkipLocalsInit]` and remove Fody. --- Bench/Bench.csproj | 2 +- Directory.Build.targets | 15 --------------- README.md | 2 -- Test/Test.csproj | 2 +- VxSort/FodyWeavers.xml | 4 ---- VxSort/FodyWeavers.xsd | 34 ---------------------------------- VxSort/InternalsVisibleTo.cs | 1 - VxSort/LocalsInit.cs | 4 ++-- VxSort/VxSort.csproj | 6 +----- 9 files changed, 5 insertions(+), 65 deletions(-) delete mode 100644 VxSort/FodyWeavers.xml delete mode 100644 VxSort/FodyWeavers.xsd diff --git a/Bench/Bench.csproj b/Bench/Bench.csproj index dc5e5b3..4c4dfd4 100644 --- a/Bench/Bench.csproj +++ b/Bench/Bench.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 diff --git a/Directory.Build.targets b/Directory.Build.targets index f5c86e7..06aebe0 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,20 +1,5 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - all - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/README.md b/README.md index 249b736..6087375 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,6 @@ VxSort is based on the following ideas/papers: VxSort uses the following projects: -* [**`Fody`**](https://github.com/Fody/Fody) by the Fody developers. -* [**`LocalsInit.Fody`**](https://github.com/ltrzesniewski/LocalsInit.Fody/tree/master/src) for getting rid of `.locals init` by [Lucas Trzesniewski](https://github.com/ltrzesniewski) * The Logo `sort` by Markus from the Noun Project ## Author diff --git a/Test/Test.csproj b/Test/Test.csproj index eccd3d0..d96883c 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -1,6 +1,6 @@  - netcoreapp3.1 + net6.0 diff --git a/VxSort/FodyWeavers.xml b/VxSort/FodyWeavers.xml deleted file mode 100644 index a2e0dae..0000000 --- a/VxSort/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/VxSort/FodyWeavers.xsd b/VxSort/FodyWeavers.xsd deleted file mode 100644 index fc0e9f1..0000000 --- a/VxSort/FodyWeavers.xsd +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - Defines the default value for the localsinit flag. - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/VxSort/InternalsVisibleTo.cs b/VxSort/InternalsVisibleTo.cs index 0e18478..a775654 100644 --- a/VxSort/InternalsVisibleTo.cs +++ b/VxSort/InternalsVisibleTo.cs @@ -1,5 +1,4 @@ using System.Runtime.CompilerServices; -using LocalsInit; [assembly: InternalsVisibleTo("Test")] [assembly: InternalsVisibleTo("Bench")] diff --git a/VxSort/LocalsInit.cs b/VxSort/LocalsInit.cs index c73e5a1..308d182 100644 --- a/VxSort/LocalsInit.cs +++ b/VxSort/LocalsInit.cs @@ -1,4 +1,4 @@ -using LocalsInit; +using System.Runtime.CompilerServices; -[assembly: LocalsInit(false)] +[module: SkipLocalsInit] diff --git a/VxSort/VxSort.csproj b/VxSort/VxSort.csproj index bef8e48..163bd3c 100644 --- a/VxSort/VxSort.csproj +++ b/VxSort/VxSort.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 true VxSort damageboy @@ -22,10 +22,6 @@ ..\vxsort.png - - - - From 6e410cd5c1ca57736eb355255833748e78e21f93 Mon Sep 17 00:00:00 2001 From: Theodore Tsirpanis Date: Fri, 17 Jun 2022 01:28:31 +0300 Subject: [PATCH 2/2] Use static SHA hashing methods. --- Test/DataGeneration.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Test/DataGeneration.cs b/Test/DataGeneration.cs index a227cb1..d63cb35 100644 --- a/Test/DataGeneration.cs +++ b/Test/DataGeneration.cs @@ -24,18 +24,14 @@ internal static (int[] randomData, int[] sortedData, string reproContext) Genera Array.Sort(sorted); } - var reproContext = ""; + Span hash = stackalloc byte[20]; + SHA1.HashData(MemoryMarshal.Cast(new ReadOnlySpan(data)), hash); + var dataHash = Convert.ToBase64String(hash); + SHA1.HashData(MemoryMarshal.Cast(new ReadOnlySpan(sorted)), hash); + var sortedHash = Convert.ToBase64String(hash); - using (var sha1 = new SHA1CryptoServiceProvider()) { - Span hash = stackalloc byte[20]; - sha1.TryComputeHash(MemoryMarshal.Cast(new ReadOnlySpan(data)), hash, out _); - var dataHash = Convert.ToBase64String(hash); - sha1.TryComputeHash(MemoryMarshal.Cast(new ReadOnlySpan(sorted)), hash, out _); - var sortedHash = Convert.ToBase64String(hash); + var reproContext = $"[{size},{seed}] -> [{dataHash},{sortedHash}]"; - reproContext = $"[{size},{seed}] -> [{dataHash},{sortedHash}]"; - } - return (data, sorted, reproContext); } }