byte_perm(x,y,s) returns a 32-bit integer consisting of four bytes from eight input bytes provided in the two input integers x
and y
, as specified by a selector, s
.
The input bytes are indexed as follows:
input[0] = x<0:7> input[1] = x<8:15>
input[2] = x<16:23> input[3] = x<24:31>
input[4] = y<0:7> input[5] = y<8:15>
input[6] = y<16:23> input[7] = y<24:31>
The selector indices are stored in 4-bit nibbles (with the upper 16-bits of the selector not being used):
selector[0] = s<0:3> selector[1] = s<4:7>
selector[2] = s<8:11> selector[3] = s<12:15>
- Returns:
- The returned value r is computed to be:
result[n] := input[selector[n]]
where result[n]
is the nth byte of r.