public unsafe void Compress33Test() { byte[] data = GetRandomBytes(33); byte[] actual = Hash160.Compress33(data); byte[] expected = ComputeHash160(data); Assert.Equal(expected, actual); }
public unsafe void Compress33Test() { using Hash160 hash = new Hash160(); byte[] data = Helper.HexToBytes(CompPub); byte[] actual = hash.Compress33(data); byte[] expected = Helper.HexToBytes(CompPubHex); Assert.Equal(33, data.Length); Assert.Equal(expected, actual); }
public unsafe void Compress33Test() { using Hash160 hash = new Hash160(); byte[] data = new byte[33]; Helper.FillRandomByte(data); byte[] actual = hash.Compress33(data); byte[] expected = 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(toHash); return(actual.SequenceEqual(hash)); }
public override unsafe bool Compare(ulong *hPt) { Scalar key = new(hPt, out int overflow); if (overflow != 0) { return(false); } _calc.GetPubkey(in key, out Span <byte> comp, out Span <byte> uncomp); ReadOnlySpan <byte> compHash = Hash160.Compress33(comp); if (compHash.SequenceEqual(hash)) { return(true); } ReadOnlySpan <byte> uncompHash = Hash160.Compress65(uncomp); return(uncompHash.SequenceEqual(hash)); }