You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not entirely sure I understand the API design. We have two types, ctx and t -- but what is the fundamental difference?
A ctx we can create by either empty or init -- hold on, should the ctx returned by empty be immutable or better not being used?
A t we receive from get, but also from the functions that take care of computing the hash of a string / string list /...
Now, the nicely introduced get_into_bytes is defined on ctx, so if I computed the hash with digest_string, I can't extract it into an existing byte vector.
Would it be possible to simplify the API and only provide a single type t? Since it is private anyways, I'd expect no issues... What do you think?
The text was updated successfully, but these errors were encountered:
I got confused when thinking about this code from mirage-crypto's hmac_drbg RNG:
letrec gooffkv=function|0 -> v
|1 ->
let v =H.hmac_string ~key:k v |>H.to_raw_string inlet len =let rem = len modH.digest_size inif rem =0thenH.digest_size else rem
inBytes.unsafe_blit_string v 0 buf off len;
v
|i ->
let v =H.hmac_string ~key:k v |>H.to_raw_string inBytes.unsafe_blit_string v 0 buf off H.digest_size;
go (off +H.digest_size) k v (pred i)
To avoid further allocations, also a ?len parameter for get_into_bytes would be great.
Hey,
I'm not entirely sure I understand the API design. We have two types,
ctx
andt
-- but what is the fundamental difference?A
ctx
we can create by eitherempty
orinit
-- hold on, should thectx
returned byempty
be immutable or better not being used?A
t
we receive fromget
, but also from the functions that take care of computing the hash of a string / string list /...Now, the nicely introduced
get_into_bytes
is defined onctx
, so if I computed the hash withdigest_string
, I can't extract it into an existing byte vector.Would it be possible to simplify the API and only provide a single type t? Since it is private anyways, I'd expect no issues... What do you think?
The text was updated successfully, but these errors were encountered: