예제 #1
0
        public static Sha1Wire Convert(this Sha1 model)
        {
            Sha1Wire wire;

            byte[] rented = ArrayPool <byte> .Shared.Rent(Sha1.ByteLength);

            {
                model.CopyTo(rented); // TODO: Perf

                wire = new Sha1Wire
                {
                    Set  = true,
                    Data = Google.Protobuf.ByteString.CopyFrom(rented, 0, Sha1.ByteLength)
                };
            }
            ArrayPool <byte> .Shared.Return(rented);

            return(wire);
        }
예제 #2
0
 public static Sha1?Convert(this Sha1Wire wire)
 {
     if (wire == null || !wire.Set)
     {
         return(default);