I\'m working on an implementation of one of the SHA3 candidates, JH. I\'m at the point where the algorithm pass all KATs (Known Answer Tests) provided by NIST, and have also mad
The lower graph shows that a lot of memory is occupied by lists. Unless there are more lurking in other modules, they can only come from e8
. Maybe you'll have to bite the bullet and make that a loop instead of a fold, but for starters, since Block1024
is a pair, the foldl'
doesn't do much evaluation on the fly (unless the strictness analyser has become significantly better). Try making that stricter, data Block1024 = B1024 !Block512 !Block512
, perhaps it also needs {-# UNPACK #-}
pragmas. In roundFunction
, use rem
instead of mod
(this will only have minor impact, but it's a bit faster) and make the let
bindings strict. In the swapN
functions, you might get better performance giving the constants in the form W x y
rather than as 128-bit hex numbers.
I can't guarantee those changes will help, but that's what looks most promising after a short glance.