Bytes To Hex String - CSharp System

CSharp examples for System:Byte

Description

Bytes To Hex String

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//  w  w w  .ja  v  a 2 s .  c om

public class Main{
        public static string BytesToHexString(byte[] input)
        {
            StringBuilder hexString = new StringBuilder(64);

            for (int i = 0; i < input.Length; i++)
            {
                hexString.Append(String.Format("{0:X2}", input[i]));
            }
            return hexString.ToString();
        }
}

Related Tutorials