More comments, better naming.
:: core
::
++ hash
+ :> per: permutation function with configurable width.
+ :> pad: padding function.
+ :> rat: bitrate, size in bits of blocks to operate on.
+ :> cap: capacity, bits of sponge padding.
+ :> out: length of desired output, in bits.
+ :> inp: input to hash.
|= $: per=$-(@ud $-(@ @))
pad=$-([octs @ud] @)
rat=@ud
++ sponge
:> sponge construction
::
- :> premute: permutation function with configurable width.
+ :> preperm: permutation function with configurable width.
:> padding: padding function.
:> bitrate: size of blocks to operate on.
:> capacity: sponge padding.
- |= $: premute=$-(@ud $-(@ @))
+ |= $: preperm=$-(@ud $-(@ @))
padding=$-([octs @ud] @)
bitrate=@ud
capacity=@ud
:: preparing
=+ bitrate-bytes=(div bitrate 8)
=+ blockwidth=(add bitrate capacity)
- =+ permute=(premute blockwidth)
+ =+ permute=(preperm blockwidth)
::
|= [input=octs output=@ud]
|^ ^- @
