Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using secretbox where the full payload isnt available/cant fit in memory? #139

Open
jdgordon opened this issue Mar 1, 2023 · 0 comments

Comments

@jdgordon
Copy link

jdgordon commented Mar 1, 2023

Hi,

I'm trying to find a suitable encryption library for a very small embedded device I'm working on where we want to encrypt some data as it is generated, trying to understand if libhydrogen would work for us.

What we'd like to do is encrypt each part of the data as it arrives (a few hundred bytes, not necessarily constant size) and append that to a file. We also need to read-back and decrypt the file at runtime (Without storing the whole thing in memory to do it).
My understanding is that each call to hydro_secretbox_encrypt adds the 36byte header which isnt useful to determine how many bytes follow to decrypt?
Is there a way to reuse the internal functions to basically stream bytes onto the encrypted file? Or do I need to add some metadata to the file to support individual decryptions? (i.e 2 bytes length, 36 byte secretbox header, <length> bytes encrypted and do each block at a time?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant