up
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using StellaOps.Replay.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace StellaOps.Replay.Core.Tests;
|
||||
|
||||
public sealed class DeterministicHashTests
|
||||
{
|
||||
[Fact]
|
||||
public void Sha256Hex_ComputesLowercaseDigest()
|
||||
{
|
||||
var digest = DeterministicHash.Sha256Hex("replay-core");
|
||||
|
||||
digest.Should().Be("a914f5ac6a57aab0189bb55bcb0ef6bcdbd86f77198c8669eab5ae38a325e41d");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MerkleRootHex_IsDeterministic()
|
||||
{
|
||||
var leaves = new[] { "alpha", "beta", "gamma" }
|
||||
.Select(Encoding.UTF8.GetBytes)
|
||||
.ToList();
|
||||
|
||||
var root = DeterministicHash.MerkleRootHex(leaves);
|
||||
|
||||
root.Should().Be("50298939464ed02cbf2b587250a55746b3422e133ac4f09b7e2b07869023bc9e");
|
||||
DeterministicHash.MerkleRootHex(leaves).Should().Be(root);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user