Code:
.method public static uint8[] xorit (uint8[] input, uint8[] key) cil managed
{
.locals init(
[0] int32 i,
[1] int32 a,
[2] int32 b
)
ldc.i4.0
stloc.0 //i = 0
ldarg.0
ldlen
ldc.i4.1
sub
stloc.1 //a = input.length - 1
ldarg.1
ldlen
stloc.2 //b = key.length
br CHECK
LOOP:
ldarg.0
ldloc.0
ldarg.0
ldloc.0
ldelem.u1 //load intput[i] as int32
ldarg.1
ldloc.0
ldloc.2
rem
ldelem.u1 //load key[i MOD b] as int32
xor //intput[i] XOR key[i MOD b]
stelem.i1 //save in input[i] as uint8
ldloc.0
ldc.i4.1
add
stloc.0 //i = i + 1
CHECK:
ldloc.0 //i
ldloc.1 //a
bne.un LOOP // i != a ?
ldarg.0
ret //return input
}






