Filtration Residue

Discussion of challenges you have already solved
Post Reply
smutley
Posts: 4
Joined: Mon Nov 23, 2009 7:50 am

Filtration Residue

Post by smutley »

I loved this challenge. I learnt so much more about the PNG format and I thought that the idea was brilliant. Kudos to teebee - it must have taken ages to create.
User avatar
teebee
Posts: 89
Joined: Mon Nov 10, 2008 3:21 pm
Location: Germany

Post by teebee »

Thanks, I am pleased that you enjoyed the challenge. To create the image I patched `pngtest.c' and `pngwutil.c' of the libpng library (http://www.libpng.org/pub/png/) which wasn't such difficult.

Using `pngcheck' and `perl' the challenge can be solved in one line as follows:

Code: Select all

pngcheck -vv residue.png | perl -ne 'if ($a) { $a = 0; push @a, map { $_ + 0 } split /\s+/, $1 if /^\s+((\d\s)*\d)/ } else { $a = 1 if /row filter/ } END { print"@a" }' | perl -lne 'BEGIN { %a = (0, "11", 1, "010", 2, "011", 3, "10", 4, "00") } $a .= join "", map { $a{$_+0} } split /\s+/; END { print map {chr} map { eval '"'"'$_ = 0b'"'"'.$_ } $a =~ /.{8}/g }'
User avatar
bsguedes
Posts: 103
Joined: Tue Feb 24, 2009 12:39 am
Location: Porto Alegre

Post by bsguedes »

teebee wrote:Thanks, I am pleased that you enjoyed the challenge. To create the image I patched `pngtest.c' and `pngwutil.c' of the libpng library (http://www.libpng.org/pub/png/) which wasn't such difficult.

Using `pngcheck' and `perl' the challenge can be solved in one line as follows:

Code: Select all

pngcheck -vv residue.png | perl -ne 'if ($a) { $a = 0; push @a, map { $_ + 0 } split /\s+/, $1 if /^\s+((\d\s)*\d)/ } else { $a = 1 if /row filter/ } END { print"@a" }' | perl -lne 'BEGIN { %a = (0, "11", 1, "010", 2, "011", 3, "10", 4, "00") } $a .= join "", map { $a{$_+0} } split /\s+/; END { print map {chr} map { eval '"'"'$_ = 0b'"'"'.$_ } $a =~ /.{8}/g }'

You still have to google the guy's last name to solve the challenge :D

Nice challenge, PNG images really offer a lot of possibilities to hide information in them.
SnakeSnake
Posts: 7
Joined: Sat Oct 16, 2010 4:19 pm
Location: germany

Post by SnakeSnake »

Of course after writing my own png reader with C/zlib I have to see here that pngcheck can display the filters too...

Anyway nice challenge I enjoyed it alot!
AMindForeverVoyaging
Forum Admin
Posts: 496
Joined: Sat May 28, 2011 9:14 am
Location: Germany

Post by AMindForeverVoyaging »

Nice challenge. Why did it take me so long to stumble upon pngcheck ;)
helly0d
Posts: 29
Joined: Fri Feb 13, 2009 2:10 am
Location: Iasi Romania

Post by helly0d »

Nice challenge. Nice one teebee.
If it works, it's obsolete !
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

helly0d wrote:Nice challenge. Nice one teebee.
Yep, definitely. This one was teaching.
Hckr
Posts: 27
Joined: Thu Mar 25, 2010 2:16 pm

Post by Hckr »

Awesome challenge teebee. It was as if you told a little story there.
Post Reply