A Tour of the Tiny and Obfuscated Image Decoder
eastfarthing.com
eastfarthing.com
At some point, I plan to write a followup post describing the encoder that I wrote. Enjoy!
While working on an encoder for it (for a future post!), I did find myself wishing that it'd also had a deblocking filter. But that might have been asking for a miracle.
Would any mathematicians be able to take it an order of magnitude further? The legendary DeCSS code is only 433 bytes, and can be represented as a prime number [0]. Imagine if images could be represented as prime numbers.
Any information can be represented by primes. Or composites for that matter.
However, I don't think that would result in any real compression. At 433 bytes, the DeCSS code takes 3464 bits. Reading the Wikipedia page you linked tells me that the smallest of the prime representations for it was 1401 decimal digits. That's worth 1401 log2(10) ≈ 4654 bits of information. So I believe that encoding it as a prime represents an increase in size in this case.
It doesn't take many bits for me to send you the illegal prime in decimal exponent representation: k*256^211+99
With a sufficiently powerful CPU on the receiving end, you can decode that into DeCSS. I would enjoy being able to send you a picture just by telling you a prime number like that.
I've corresponded a bit with Fabrice Bellard. He'd indicated that he simply hadn't found the time to clean up his encoder for publication. To be fair, I wouldn't yet consider mine to be publishable. I'll be very curious to compare them if he ever does -- the neat thing about modern lossy codecs is that there tends to be a lot of latitude for the encoders to make choices.
I'm glad you enjoyed all the detail. I had worried that perhaps there was too much but I like to be thorough.
I couldn't resist the urge to follow along and rewrite the code you've presented in Rust, and what do I find at midnight after finally getting it to work and running your test image through? You got me.
Curl reports: SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
Which Firefox will refuse to load without forcibly enabling TLS 1.0, which is actually marked for complete removal at some near point in the future. I believe Chrome's approach is similar, with the same expectation of removal.
Now might be a good time to check the site's architecture. As annoying as that probably is. (Especially as it does just appear to be a static blog).
But it is true that I need to get a certificate and upgrade it to support https. That's been on my to-do list but lower priority since, as you say, it's a static blog.
> TLSv1.0 (IN), TLS handshake, Finished (20):
> SSL connection using TLSv1.0 / DHE-RSA-AES256-SHA
> ALPN, server did not agree to a protocol
> Server certificate:
> subject: CN=*.phpwebhosting.com
> start date: Apr 7 00:07:56 2020 GMT
> expire date: Apr 8 00:07:56 2021 GMT
> subjectAltName does not match eastfarthing.com
They serve up a wildcard certificate that uses a deprecated TLS.