Open capr opened 8 years ago
Mostly to prevent accidents. For example, you decide to use the full 512-bit BLAKE2b instead of the shorter 256-bit one, but forget to update buffer sizes somewhere.
On second thought, it would make more sense to treat this outlen parameter as a buffer size, and verify that S->outlen <= outlen
.
I would personally prefer to have this parameter optional i.e. if (!outlen) outlen = S->outlen
because I don't have safety issues like that in Lua and forcing this on the API makes little sense in that context.
Otherwise I have to wrap S
just to keep the outlen
passed to init()
so I can pass it to back to final()
, or treat S
as non-opaque and get it from there.
Actually it doesn't matter, the state is not opaque anyway I can get outlen from there.
Sorry for the noise :)
blake2*_final() asks for outlen only to check if it's the same as the internal one:
why is that?