/// <summary>
        /// Converts a byte array to a hexadecimal string.
        /// </summary>
        /// <param name="bytes"></param>
        /// <returns></returns>
        public static string ToString(byte[] bytes)
        {
            // XML Reader/Writer is highly optimized for BinHex conversions
            // use instead of byte/character replacement for performance on
            // arrays larger than a few dozen elements

            System.IO.StringWriter sw = new System.IO.StringWriter();
            System.Xml.XmlTextWriter tw = new System.Xml.XmlTextWriter(sw);

            tw.WriteStartElement("node");

            tw.WriteBinHex(bytes, 0, bytes.Length);

            tw.WriteEndElement();

            tw.Flush();

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(sw.ToString());
            return doc.DocumentElement.InnerText;
        }