I have a string and i changed it to hex values , so i want to store them in the Byte array , but it gives me error of "Input String is not correct format". here is my code :
byte[] PlainText = new byte[16];
byte[] MasterKey = new byte[16];
string input = "Hello";
char[] values = input.ToCharArray();
int i =0;
foreach (char letter in values)
{
int value = Convert.ToInt32(letter);
string hexout = String.Format("{0:X}", value);
PlainText[i++] = Convert.ToByte(hexout);
}
PlainText[i++] = Convert.ToByte(letter);or evenPlainText[i++] = (byte)letter;