C# - String To Hex

public String StringToHex(String input)
{
     string hexOutput = null;
     int value;
     char[] values = input.ToCharArray();
     foreach (char letter in values)
     {
        // Get the integral value of the character.
        value = Convert.ToInt32(letter);
        // Convert the decimal value to a hexadecimal value in string form.
        hexOutput += String.Format("{0:X}", value);
        //Console.WriteLine("Hexadecimal value of {0} is {1}", letter, hexOutput);

     }

     return hexOutput;
}

Popular posts from this blog

SAP CPI - Loop Process Call with SuccessFactor (oData V2)

Setting IntelliJ IDEA to run Groovy Script

C# - BASE64 to Image