When writing in a function language, one often writes fun, odd bits of code. Today’s example is
foldr (flip (.)) id (zipWith mkStep3 ks ws) h. In this example,
mkStep3 is a function taking three parameters. So the result of
zipWith mkStep3 ks ws is a list of functions that take one parameter. These all need to be composed together. I first composed them together with
foldr (.) id, but I found out my functions were composed the wrong way. I wasn’t so keen on
foldr (.) id $ reverse $ (zipWith mkStep3 ks ws), so I settled on
foldr (flip (.)) id (zipWith mkStep3 ks ws) as above.
The SHA-2 functions are patented by the NSA. However, since software is not patentable, I don’t really care at the moment.