Skip to content

Instantly share code, notes, and snippets.

@dahlia
Last active June 16, 2021 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dahlia/b12df62cf2d6cc04e8604712512b9102 to your computer and use it in GitHub Desktop.
Save dahlia/b12df62cf2d6cc04e8604712512b9102 to your computer and use it in GitHub Desktop.
RandomXSharpSample

RandomXSharpSample

How to build:

git clone https://gist.github.com/b12df62cf2d6cc04e8604712512b9102.git
cd b12df62cf2d6cc04e8604712512b9102/
dotnet build
dotnet run

The expected output:

bc93a4f1d3588efc9d5a28793e5b8edcc887de8217f156fc9a854aa104ddebf4
using RandomXSharp;
using System;
using System.Text;
namespace RandomXSharpSample
{
class Program
{
static void Main(string[] args)
{
RandomX r = RandomX.Create();
byte[] input = Encoding.ASCII.GetBytes("hello world");
byte[] hash = r.ComputeHash(input);
for (int i = 0; i < hash.Length; i++) {
byte b = hash[i];
Console.Write("{0:x2}", b);
}
Console.WriteLine();
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RandomXSharp" Version="0.2.0-dev.14" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment