rotr() removes the last array value and places it to array-index 0 (to the the beginning). The method does that for n times. Its rotating the array x by n.
My problem is the first XORXOR parameter is w[sh1] rotatet by 7. Okay! Thats good.
The second XORXOR parameter is rotatet by 7 + 18 and the last parameter is rotatet by 7+18+3. Thats not how i want it...
The first parameter of rotr should and must always be the same array. Why is the function changing the array globally. Its not modifying the parameter and returns a copy of that modification? With return? Always used Python... then one time a little bit JS and its completely getting on my nerves... can someone help me and explain it to me?? my whole algorithm is a failure because of that *****
const s0 = XORXOR(rotr(w[sh1], 7), rotr(w[sh1], 18), shr(w[sh1], 3))
function rotr(x, n) {
for(let c = 0; c<n; c++) {
x.unshift(x.pop());
}
return x
}