From 163fb8eab71ea2d71d1fcf359dfcc378fd3b5c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=A4ckel?= Date: Wed, 20 Jul 2016 22:39:31 +0200 Subject: [PATCH] decode optimization using unbuffered dd instead of sed redirecting the output of `sed` into the main loop of the decryption process lead to an unneccessary execution time and memory usage as the call had to end before the loop started it's work. --- ocdec.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ocdec.sh b/ocdec.sh index 863773f..d455743 100755 --- a/ocdec.sh +++ b/ocdec.sh @@ -139,7 +139,8 @@ function decryptFile() { iv=$(echo -n "$iv" | od -An -tx1 | tr -dc '[:xdigit:]' ) # decode chunk openssl enc -AES-256-CFB -d -nosalt -base64 -A -K $decFileKeyContentHEX -iv $iv -in <(echo "$payload") - done <<<`sed -r 's/^HBEGIN:.+:HEND-*//' <"${USER}/$encFilePath"` # pipe the encrypted file without head into the loop + #done <<<`sed -r 's/^HBEGIN:.+:HEND-*//' <"${USER}/$encFilePath"` # pipe the encrypted file without head into the loop + done < <(dd bs=$chunkSize skip=1 if="${USER}/$encFilePath") # --- Decrypt the file --- }