I'm trying to convert this function from C# to php, but how do I deal with needing to type cast to a byte data type (up to 0xFF) when php only deals with integers?
public static byte[] CreateKeyBlock()
{
byte[] ac = new byte[6];
for (int j = 0; j < 6; j++)
{
ac[j] = (byte)Rand.Next(0, 255);
int i;
byte d;
ac[3] = (byte)(ac[1] ^ ac[2] ^ ac[4]);
ac[0] = (byte)((ac[4] ^ ac[1]) + ac[2]);
ac[5] = 0;
d = (byte)0xd5;
for (i = 0; i < 102; i++)
{
if (i % 5 != 0)
{
ac[(i % 6)] = (byte)(ac[(i % 6)] + d);
d = ac[(i % 6)];
}
else
{
ac[(i % 6)] = (byte)(ac[(i % 6)] ^ d);
d = ac[(i % 6)];
}
}
}
return ac;
}