Hi guys
hope someone can convert this piece of code to C# code :
static char s0, s1, s2, s3, s4, s5;
static char byteConv (char byte, int byteNum)
{
static char b, shift;
static char i, c;
switch (byteNum)
{
case 0 : c = byte ^ s0; break;
case 1 : c = byte ^ s1; break;
case 2 : c = byte ^ s2; break;
case 3 : c = byte ^ s3; break;
case 4 : c = byte ^ s4; break;
case 5 : c = byte ^ s5; break;
}
shift = 0;
for (i = 0; i < 8; i++) shift += ((c >> i) & 0x01);
shift = (shift + s0 + s1 + s2 + s3 + s4 + s5) & 0x07;
b = (c >> shift) | (c << (8 - shift));
return b;
}
static void responseCode (char challenge0,
char challenge1,
char challenge2,
char challenge3,
char challenge4,
char challenge5,
char *response0,
char *response1,
char *response2,
char *response3,
char *response4,
char *response5)
{
static char b0, b1, b2, b3, b4, b5;
b0 = byteConv (challenge0, 0);
b1 = byteConv (challenge1, 1);
b2 = byteConv (challenge2, 2);
b3 = byteConv (challenge3, 3);
b4 = byteConv (challenge4, 4);
b5 = byteConv (challenge5, 5);
*response0 = (b1 + b2 - b3 + b4 - b5) ^ b0;
*response1 = (b2 + b3 - b4 + b5 - b0) ^ b1;
*response2 = (b3 + b4 - b5 + b0 - b1) ^ b2;
*response3 = (b4 + b5 - b0 + b1 - b2) ^ b3;
*response4 = (b5 + b0 - b1 + b2 - b3) ^ b4;
*response5 = (b0 + b1 - b2 + b3 - b4) ^ b5;
}
thanks in advice.