Lidgren.Network.NetUtility.ToHexString C# (CSharp) Méthode

ToHexString() public static méthode

Create a hex string from an array of bytes
public static ToHexString ( byte data ) : string
data byte
Résultat string
		public static string ToHexString(byte[] data)
		{
			char[] c = new char[data.Length * 2];
			byte b;
			for (int i = 0; i < data.Length; ++i)
			{
				b = ((byte)(data[i] >> 4));
				c[i * 2] = (char)(b > 9 ? b + 0x37 : b + 0x30);
				b = ((byte)(data[i] & 0xF));
				c[i * 2 + 1] = (char)(b > 9 ? b + 0x37 : b + 0x30);
			}
			return new string(c);
		}

Same methods

NetUtility::ToHexString ( long data ) : string

Usage Example

Exemple #1
0
        /// <summary>
        /// Compute client public ephemeral value (A)
        /// </summary>
        public static byte[] ComputeClientEphemeral(byte[] clientPrivateEphemeral)         // a
        {
            // A= g^a (mod N)
            NetBigInteger a      = new NetBigInteger(NetUtility.ToHexString(clientPrivateEphemeral), 16);
            NetBigInteger retval = g.ModPow(a, N);

            return(retval.ToByteArrayUnsigned());
        }
All Usage Examples Of Lidgren.Network.NetUtility::ToHexString