The best way to translate the code is to figure out fundamentally what the intent of the code is.

For example:


ulong num = 0uL;
for (int j = 0; j < 5; j++)
{
num <<= 8;
num |=...