for($reg3=0; $reg3<128; $reg3++)
{
$reg1[$reg3] = $reg1[$reg3] ^ ($reg6[$reg3+256] & 1);
}
I really don't understand what is happening here $reg1[$reg3] ^ ($reg6[$reg3+256] & 1);
and what would be it's vb.net equivalent code.
It is performing a bitwise XOR between two operands, one of which is produced by applying a bitwise AND to two other operands. Other than that, it's standard array indexes and addition.
The VB.Net code would be exactly the same if the types of the expressions support these operators (we don't know what the values of the variables are).
^
and &
are binary/bitwise operators - more here: Bitwise Operators
^
- Xor (exclusive or)&
- And
I'm guessing this is recompiled code or obfuscated - if not, thems some horrible variable names.
Switching for more traditional variable names: $reg3
->$i
, $reg1
->$a
, $reg6
->$b
we get:
for($i=0; $i<128; $i++) {
$a[$i] = $a[$i] ^ ($b[$i+256] & 1);
}
It goes through the first 128 elements of array (or perhaps string) $a
. For each element, XOR it (^ ($b...
) with the last bit only (& 1
) of an element in array (or string) $b
that is 256 places further on. $a
must be at least 128 elements, $b
must be at least 384 elements.
& is a bitwise AND operator.
^ is a bitwise XOR operator.