I am new to Go so I am not sure if this is possible.
I found an example here for encrypting and decrypting a file, but as you can see, it requires the entire file to be loaded in memeory as a byte array.
It is possible to encrypt a file reader stream so that the result can be pipe into a writer stream using io.Copy()?
评论:
pcj2bs:
elagergren:There's an example in the docs that does that!
I really wouldn't recommend using it for anything serious because it hasn't been looked over by another set of eyes, but an interesting little package I wrote a while back was https://github.com/ericlagergren/boxer.
It uses secretbox (NaCl) to encrypt chunks and puts the chunk number in the nonce. The idea is from https://www.imperialviolet.org/2014/06/27/streamingencryption.html
