From 9b41cd961b6bbe48b01329748f45bf6b5f3e388b Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sat, 25 Nov 2023 14:50:12 +0100 Subject: [PATCH] fix block chaining --- crypto.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crypto.go b/crypto.go index a977af5..67726bd 100644 --- a/crypto.go +++ b/crypto.go @@ -155,7 +155,12 @@ func Encrypt(c *Conf, filename string) error { for i := 0; i < c.count; i++ { for { - EncryptChunk(aead, outfile, size) + if size < chunkSize { + EncryptChunk(aead, outfile, size) + break + } + + EncryptChunk(aead, outfile, chunkSize) size = size - chunkSize if size <= 0 {