#!/usr/bin/env bash
set -euo pipefail
outdir="${1:-task5_out}"
key="${2:-00112233445566778899aabbccddeeff}"
iv="${3:-0102030405060708090a0b0c0d0e0f10}"
openssl enc -aes-128-ecb -d -in "$outdir/task5_ecb_corrupt.bin" -out "$outdir/task5_ecb_dec.txt" -K "$key"
openssl enc -aes-128-cbc -d -in "$outdir/task5_cbc_corrupt.bin" -out "$outdir/task5_cbc_dec.txt" -K "$key" -iv "$iv"
openssl enc -aes-128-cfb -d -in "$outdir/task5_cfb_corrupt.bin" -out "$outdir/task5_cfb_dec.txt" -K "$key" -iv "$iv"
openssl enc -aes-128-ofb -d -in "$outdir/task5_ofb_corrupt.bin" -out "$outdir/task5_ofb_dec.txt" -K "$key" -iv "$iv"
