Skip to content

Using the same HMAC state without re-init #1240

Answered by jedisct1
Tachi107 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi!

The crypto_auth_*_state values can be copied. Libsodium doesn't do dynamic allocations, so there are no pointers inside and you can just copy them as a blob of bytes.

So, before calling _final(), copy the state, and reuse it afterwards as needed.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@jedisct1
Comment options

Answer selected by Tachi107
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants