- Joined
- Nov 6, 2010
- Messages
- 1,561
- Reaction score
- 394
I have the following code to convert a 16-byte array to a uint32 array with 4 values.
Simple enough right? If that were the correct code, sure..
This is the array I'll get, converting like this:
It gives me, indeed, 4 uint32s.
but I need THIS to be the output:
This is what the byte array looks like, before anything happens:
How do I get the desired output?
Code:
Console.Write("DATA: ");
String dataStr = Console.ReadLine();
Console.Write("KEY: ");
String keyStr = Console.ReadLine();
byte[] keyBytes = new byte[16];
keyBytes = Encoding.ASCII.GetBytes(keyStr);
foreach(byte element in keyBytes)
{
if (i < 4)
{
uint uKey = Convert.ToUInt32(element);
uKeyArray[i] = uKey;
i++;
}
}
Simple enough right? If that were the correct code, sure..
This is the array I'll get, converting like this:
Code:
0x00000066 0x0000006f 0x0000006f 0x00000062
It gives me, indeed, 4 uint32s.
but I need THIS to be the output:
Code:
0x666f6f62 0x61720000 0x00000000 0x00000000
This is what the byte array looks like, before anything happens:
Code:
66 6f 6f 62 - 61 72 00 00 - 00 00 00 00 - 00 00 00 00
How do I get the desired output?

