public unsafe void Compress33_P2shTest() { byte[] data = GetRandomBytes(33); byte[] actual = Hash160.Compress33_P2sh(data); // Hash160(0x0014-Hash160(pub)) byte[] expected = ComputeHash160(new byte[] { 0, 20 }.ConcatFast(ComputeHash160(data))); Assert.Equal(expected, actual); }
public unsafe void Compress33_P2shTest() { using Hash160 hash = new Hash160(); byte[] data = new byte[33]; Helper.FillRandomByte(data); byte[] actual = hash.Compress33_P2sh(data); // Hash160(0x0014-Hash160(pub)) byte[] expected = ComputeHash160(new byte[] { 0, 20 }.ConcatFast(ComputeHash160(data))); Assert.Equal(expected, actual); }
public override unsafe bool Compare(ulong *hPt) { Scalar key = new(hPt, out int overflow); if (overflow != 0) { return(false); } Span <byte> toHash = _calc.GetPubkey(in key, true); ReadOnlySpan <byte> actual = Hash160.Compress33_P2sh(toHash); return(actual.SequenceEqual(hash)); }