public byte[] ToSerialized() { var result = new byte[2 + 2 + X.Length + 2 + Y.Length]; BinaryPrimitives.WriteUInt16LittleEndian(result, EC_OpenSSL_NID); var pos = 2; ByteArrayUtils.SaveInsideBytes(X, ref result, ref pos); ByteArrayUtils.SaveInsideBytes(Y, ref result, ref pos); return(result); }
internal bool LoadFromBytes(byte[] bytes, ref int startIndex) { Clear(); if (startIndex + 2 + 2 + 2 > bytes.Length) { return(false); } EC_OpenSSL_NID = BinaryPrimitives.ReadUInt16LittleEndian(bytes.AsSpan(startIndex)); startIndex += 2; return(ByteArrayUtils.LoadFromBytes(bytes, ref startIndex, ref X) && ByteArrayUtils.LoadFromBytes(bytes, ref startIndex, ref Y)); }
internal bool FromSerialized(Stream stream) { Span <byte> tmp = stackalloc byte[2]; if (stream.Read(tmp.Slice(0, 2)) != 2) { return(false); } EC_OpenSSL_NID = BinaryPrimitives.ReadUInt16LittleEndian(tmp); return(ByteArrayUtils.FromSerialized(ref X, stream) >= 0 && ByteArrayUtils.FromSerialized(ref Y, stream) >= 0); }
public static byte[] DoRipeMD160_HEXASTRING(byte[] message) => ByteArrayUtils.FromString(DoRipeMD160AsRaw(message).ToHexaString().Substring(0, 40));
internal int GetSerializedLength() => 2 + ByteArrayUtils.GetSerializedLength(X) + ByteArrayUtils.GetSerializedLength(Y);