Skip to content

Instantly share code, notes, and snippets.

@heyajulia
Created August 9, 2025 15:35
Show Gist options
  • Save heyajulia/9ab6ed385072df6055afcb4577cc3a87 to your computer and use it in GitHub Desktop.
Save heyajulia/9ab6ed385072df6055afcb4577cc3a87 to your computer and use it in GitHub Desktop.
# 0) Make the image blockier so the effect is actually noticeable
convert Mona_Lisa,_by_Leonardo_da_Vinci,_from_C2RMF_retouched.jpg.webp -colors 2 -posterize 2 mona_lisa_flat.png
# 1) Flatten alpha onto white, 24-bit BMP v3 header (54-byte header)
convert mona_lisa_flat.png \
-background white -alpha remove -alpha off \
-define bmp:subtype=RGB24 bmp3:mona.bmp
# 2) Split header + pixels exactly at offset (54)
dd if=mona.bmp of=header.bin bs=1 count=54
dd if=mona.bmp of=pixels.bin bs=1 skip=54
# 3) Encrypt pixels ONLY (no salt, no padding)
KEY=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
openssl enc -aes-256-ecb -K $KEY -nosalt -nopad -in pixels.bin -out pixels.ecb
# 4) Reassemble
cat header.bin pixels.ecb > mona_ecb.bmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment