I am trying to understand how scrypt
works. I am referring to the Algorithm section of scrypt
's Wikipedia page. There I find this BlockMix
function:
Function BlockMix(B):
(B0, ... , B2r-1) ← B
X ← B2r−1
for i = 0 to 2r − 1 do
X ← H(X ⊕ Bi)
Yi ← X
end for
Output ← (Y0, Y2, ... , Y2r−2, Y1, Y3, ... , Y2r−1)
Now, as far as my understanding goes, this means: expand an r
-bytes block into its single bytes, namely, B0, ..., B2r-1
. Set X
to the last byte, and propagate some perturbation by updating X
with H(X ⊕ Bi)
. Finally return the output bytes, somehow shuffled (first the even, then the odds).
What I don't understand is the meaning of that H
function. It's nowhere specified what it is. I guess it is a function that inputs one byte and outputs one byte. Is that a commonly known function? H
usually stands for hash. Should I just pick any random bijection between the numbers in [0, 255]
?
Anyone answering my question might as well consider to add this information to the Wikipedia page, to help the next reader.