public unsafe void Compress65Test() { byte[] data = GetRandomBytes(65); byte[] actual = Hash160.Compress65(data); byte[] expected = ComputeHash160(data); Assert.Equal(expected, actual); }
public unsafe void Compress65Test() { using Hash160 hash = new Hash160(); byte[] data = Helper.HexToBytes(UncompPub); byte[] actual = hash.Compress65(data); byte[] expected = Helper.HexToBytes(UncompPubHex); Assert.Equal(65, data.Length); Assert.Equal(expected, actual); }
public unsafe void Compress65Test() { using Hash160 hash = new Hash160(); byte[] data = new byte[65]; Helper.FillRandomByte(data); byte[] actual = hash.Compress65(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, false); ReadOnlySpan <byte> compHash = Hash160.Compress65(toHash); return(compHash.SequenceEqual(hash)); }
public override unsafe bool Compare(uint *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)); }