public void Serialize(Memory <byte> bytes) { FixedWithSerializer.SerializeToMemory(bytes, new dynamic[] { _id, _x }); }
public static PrivateKey FromBytes(ReadOnlyMemory <byte> bytes) { var res = FixedWithSerializer.Deserialize(bytes, out _, typeof(int), typeof(Fr)); return(new PrivateKey((Fr)res[1], (int)res[0])); }
public static PublicKeySet FromBytes(ReadOnlyMemory <byte> bytes) { var faulty = bytes.Span.Slice(0, 4).ToInt32(); return(new PublicKeySet(FixedWithSerializer.DeserializeHomogeneous <PublicKey>(bytes.Slice(4)), faulty)); }
public IEnumerable <byte> ToBytes() { return(Threshold.ToBytes().Concat(FixedWithSerializer.SerializeArray(_keys))); }
public static PublicKey FromBytes(ReadOnlyMemory <byte> buffer) { var res = FixedWithSerializer.Deserialize(buffer, out _, typeof(int), typeof(G1)); return(new PublicKey((G1)res[1], (int)res[0])); }
public static EncryptedShare FromBytes(ReadOnlyMemory <byte> bytes) { var res = FixedWithSerializer.Deserialize(bytes, out var offset, typeof(int), typeof(G1), typeof(G2)); return(new EncryptedShare((G1)res[1], bytes.Slice(offset).ToArray(), (G2)res[2], (int)res[0])); }