Skip to content

Instantly share code, notes, and snippets.

@rfl890
Last active February 24, 2025 01:22
Show Gist options
  • Save rfl890/044a0ef53072814bad97f9bd93d5ec62 to your computer and use it in GitHub Desktop.
Save rfl890/044a0ef53072814bad97f9bd93d5ec62 to your computer and use it in GitHub Desktop.
Shell one-liner to display the weakness of AES-ECB
# requires ffmpeg, openssl, coreutils, and curl
curl https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/864px-Tux.svg.png | ffmpeg -i - -f rawvideo - | openssl enc -nopad -e -aes-256-ecb -K $(sha256sum <<< "yourkeyhere" | cut -d ' ' -f 1) | ffmpeg -f rawvideo -pixel_format rgba -video_size 864x1024 -i - -f image2 -c:v png - | ffplay -
# Alternatively, using the (somewhat) better AES-CBC mode
curl https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/864px-Tux.svg.png | ffmpeg -i - -f rawvideo - | openssl enc -nopad -e -aes-256-cbc -K $(sha256sum <<< "yourkeyhere" | cut -d ' ' -f 1) -iv "01010101010101010101010101010101" | ffmpeg -f rawvideo -pixel_format rgba -video_size 864x1024 -i - -f image2 -c:v png - | ffplay -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment