When viewing the algorithm, BlowFish found this line:
#define S(x,i) (SBoxes[i][xwbyte##i])
What does ##
mean?
When viewing the algorithm, BlowFish found this line:
#define S(x,i) (SBoxes[i][xwbyte##i])
What does ##
mean?
This is a string connection.
In this case, the value of the macro parameter is "pasted" to the byte
Suppose a macro is called with the parameters var
and 1
, then
S(var, 1)
will be replaced by the preprocessor on
(SBoxes[1][var.w.byte1])
and the challenge
S(var, str)
on
(SBoxes[str][var.w.bytestr])
and so on
This is token pasting, merging tokens at the preprocessor level.
For example, S(field,5)
(SBoxes[5][field.w.byte5])
to (SBoxes[5][field.w.byte5])
.
Documentation:
Source: https://ru.stackoverflow.com/questions/565015/
All Articles