Skip to content

Commit b9f085c

Browse files
committed
Breaking change: Blake3 is now fully managed, Blake3.Native is the previous Blake3
1 parent 9532b99 commit b9f085c

23 files changed

Lines changed: 1010 additions & 1028 deletions

File tree

src/Blake3.Benchmarks/Blake3.Benchmarks.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<Content Include="..\Blake3\runtimes\$(NETCoreSdkRuntimeIdentifier)\native\*.*">
17+
<Content Include="..\Blake3.Native\runtimes\$(NETCoreSdkRuntimeIdentifier)\native\*.*">
1818
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1919
</Content>
2020
</ItemGroup>
2121

2222
<ItemGroup>
2323
<ProjectReference Include="..\Blake3\Blake3.csproj" />
24-
<ProjectReference Include="..\Blake3.Sharp\Blake3.Sharp.csproj" Aliases="ManagedBlake3" />
24+
<ProjectReference Include="..\Blake3.Native\Blake3.Native.csproj" Aliases="NativeBlake3"/>
2525
</ItemGroup>
2626

2727
</Project>

src/Blake3.Benchmarks/Program.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern alias ManagedBlake3;
1+
extern alias NativeBlake3;
22
using BenchmarkDotNet.Attributes;
33
using BenchmarkDotNet.Configs;
44
using BenchmarkDotNet.Diagnosers;
@@ -9,7 +9,7 @@
99
using CommandLine;
1010
using System;
1111
using System.Runtime.InteropServices;
12-
using SharpHasher = ManagedBlake3::Blake3.Hasher;
12+
using NativeHasher = NativeBlake3::Blake3.Hasher;
1313
using ManagedHasher = Blake3.Managed.Hasher;
1414

1515
namespace Blake3.Benchmarks
@@ -29,35 +29,35 @@ public void Setup()
2929
new Random(42).NextBytes(_data);
3030
}
3131

32-
[Benchmark(Baseline = true, Description = "Blake3 native")]
33-
public uint RunBlake3Native()
32+
[Benchmark(Baseline = true, Description = "Blake3 default")]
33+
public uint RunBlake3()
3434
{
3535
return MemoryMarshal.Cast<byte, uint>(Hasher.Hash(_data).AsSpan())[0];
3636
}
3737

38-
[Benchmark(Description = "Blake3 native parallel")]
39-
public uint RunBlake3NativeParallel()
38+
[Benchmark(Description = "Blake3 parallel")]
39+
public uint RunBlake3Parallel()
4040
{
4141
using var hasher = Hasher.New();
4242
hasher.UpdateWithJoin(_data);
4343
return MemoryMarshal.Cast<byte, uint>(hasher.Finalize().AsSpan())[0];
4444
}
4545

46-
[Benchmark(Description = "Blake3 sharp")]
47-
public uint RunBlake3Sharp()
46+
[Benchmark(Description = "Blake3 native")]
47+
public uint RunBlake3Native()
4848
{
49-
return MemoryMarshal.Cast<byte, uint>(SharpHasher.Hash(_data).AsSpan())[0];
49+
return MemoryMarshal.Cast<byte, uint>(NativeHasher.Hash(_data).AsSpan())[0];
5050
}
5151

52-
[Benchmark(Description = "Blake3 sharp parallel")]
53-
public uint RunBlake3SharpParallel()
52+
[Benchmark(Description = "Blake3 native parallel")]
53+
public uint RunBlake3NativeParallel()
5454
{
55-
using var hasher = SharpHasher.New();
55+
using var hasher = NativeHasher.New();
5656
hasher.UpdateWithJoin(_data);
5757
return MemoryMarshal.Cast<byte, uint>(hasher.Finalize().AsSpan())[0];
5858
}
5959

60-
[Benchmark(Description = "Blake3 managed")]
60+
[Benchmark(Description = "Blake3 managed (ext)")]
6161
public uint RunBlake3Managed()
6262
{
6363
return MemoryMarshal.Cast<byte, uint>(ManagedHasher.Hash(_data).AsSpan())[0];

src/Blake3.NET.slnx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<File Path="global.json" />
1111
</Folder>
1212
<Project Path="Blake3.Benchmarks/Blake3.Benchmarks.csproj" />
13-
<Project Path="Blake3.Sharp/Blake3.Sharp.csproj" />
13+
<Project Path="Blake3.Native/Blake3.Native.csproj" />
1414
<Project Path="Blake3.Tests/Blake3.Tests.csproj" />
1515
<Project Path="Blake3/Blake3.csproj" />
1616
</Solution>
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,28 @@
33
<Import Project="..\Blake3\Blake3.props" />
44

55
<PropertyGroup>
6-
<TargetFramework>net10.0</TargetFramework>
7-
<AssemblyName>Blake3.Sharp</AssemblyName>
6+
<AssemblyName>Blake3.Native</AssemblyName>
87
<RootNamespace>Blake3</RootNamespace>
9-
<PackageId>Blake3.Sharp</PackageId>
10-
<Description>Blake3.Sharp is a fully managed SIMD implementation of the BLAKE3 cryptographic hash function.</Description>
8+
<PackageId>Blake3.Native</PackageId>
9+
10+
<TargetFramework>net8.0</TargetFramework>
11+
<Description>Blake3.Native is a managed wrapper around the Rust implementations of the BLAKE3 cryptographic hash function.</Description>
1112
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1213
<NoWarn>$(NoWarn);CS1591</NoWarn>
1314
<GenerateDocumentationFile>true</GenerateDocumentationFile>
14-
<!-- Add support for Source Link. -->
15+
<!--Add support for sourcelink-->
1516
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1617
<IncludeSymbols>true</IncludeSymbols>
1718
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1819
</PropertyGroup>
1920

21+
<ItemGroup>
22+
<Content Include="runtimes\**\*">
23+
<PackagePath>%(Identity)</PackagePath>
24+
<Pack>true</Pack>
25+
</Content>
26+
</ItemGroup>
27+
2028
<ItemGroup>
2129
<Compile Include="..\Blake3\Hash.cs" Link="Hash.cs" />
2230
<Compile Include="..\Blake3\Blake3HashAlgorithm.cs" Link="Blake3HashAlgorithm.cs" />
@@ -29,5 +37,4 @@
2937
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3038
</PackageReference>
3139
</ItemGroup>
32-
3340
</Project>

0 commit comments

Comments
 (0)