News for hackers. Stuff that matters.
Re:Coding Challenge for MI5 by McKayDavis on Sunday September 11, 2016 @06:50PM (#12476129)
Code-golf anyone? Here's my bash one-liner:

    pngtopnm puzzle.png | xxd -s14 -p -c3 | uniq -c | awk '{printf "%c", $1}' | xxd -r -p
Explanation:

   pngtopnm converts the image to an uncompressed bytestream format (pnm)
   xxd converts the bytes to hex representation
      -s14 skips the pnm header
      -p gives plain hex output
      -c groups by 3 byte values (RGB pixel values)
   uniq -c counts the run length encoding of the hex triplets
   awk / printf %c converts the RLE count to an ascii value
   xxd -r reverses the hex dump to the final encoded message

There are no comments on this comment yet.