using Google.Protobuf; using System; namespace FrostFS.SDK.Cryptography; public static class UUIDExtension { public static Guid ToUuid(this ByteString id) { return Guid.Parse(BitConverter.ToString(id.ToByteArray()).Replace("-", "")); } public static byte[] ToBytes(this Guid id) { var str = id.ToString("N"); var len = str.Length; var bytes = new byte[len/2]; for (int i = 0; i < len; i += 2) bytes[i/2] = Convert.ToByte(str.Substring(i, 2), 16); return bytes; } }