logoalt Hacker News

Decoding the obfuscated bash script on a Uniqlo t-shirt

414 pointsby speerertoday at 8:46 AM82 commentsview on HN

Comments

estebarbtoday at 11:57 AM

"Uniqlo x Akamai sells another design of shirt in the same range which is plainly incomplete"

Imagine having to return a t-shirt because that malfunction!

— I don't understand why are you returning this, was the size wrong or you didn't like it?

— No, there is a syntax error at line 37 that makes it impossible to run, and I'm concerned people on the street may think I promote unsafe bash scripting.

show 1 reply
wbh1today at 10:36 AM

I love this shirt! Here's a nice video from the actual designer about the process of making this shirt (including intentionally making it hard to OCR): https://youtu.be/jocGLiecpjU?t=526

show 2 replies
Tiberiumtoday at 9:17 AM

OCRing this is a nightmare and is a good benchmark to any self-proclaimed good OCR/vision model.

I think though it could likely be easily OCR'd if you give the image to any decent agentic harness with a good vision model, e.g. newest Claude/GPT ones, and tell them to split the image per lines, and then just OCR each line individually.

I wonder if the script itself was written by an LLM before obfuscation? There seem to be a lot of comments in it, but in this case it's still ok :)

show 9 replies
world2vectoday at 9:58 AM

Oh wow I saw that tshirt at the store and said to my girlfriend "no way that script is functional, probably just for show". I should have persevered.

show 1 reply
chrysopracetoday at 11:20 AM

My old colleague had one with a Go program[0] which I always thought was quite cool.

[0] https://github.com/GL-Kageyama/UNIQLO_Akamai_T-shirt_Code

show 2 replies
cb321today at 11:45 AM

For anyone that cares, this is a slightly less stupid Python version:

    #!/usr/bin/env python3
    from os   import environ; E = environ.get
    from math import sin
    from time import sleep
    text = "♥PEACE♥FOR♥ALL" # The text to sine-scroll animate
    nText  = len(text)      # Number of utf8 chars
    freq   = 0.2            # Frequency scaling factor
    color0 = 12             # xt256 Color cube segment 12..<208
    color1 = 208; nColor = color1 - color0
    (w, h) = (int(E("COLUMNS", 80)), int(E("LINES", 24)))
    t = 0
    while True:
        x = (w/2) + (w/4)*sin(t*freq)           # x pos via sine value
        x = max(0, min(w - 1, int(x + 0.5)))    # bound to tty width
        color = color0 + ((nColor*t)//h)%nColor # cycle colors
        ch = text[t%nText]  # Get char & Use xterm-256 color escs
        print("%*s\033[38;5;%sm%s\033[m\n" % (x, "", color, ch))
        t += 1
        sleep(0.1)   # original used bc shell outs to rate-limit
As mentioned in https://news.ycombinator.com/item?id=48830326 , the heart symbols did not otherwise even work for my bash and some have commented on liking the screen saver.
haileystoday at 9:49 AM

I thought it was funny that the author used a variety of OCR tools with mixed success before spending a lot of time manually fixing up the output from the best one, rather than just typing it in

show 7 replies
qiqitoritoday at 11:01 AM

I once wrote a tool that helps with finding mistakes in OCR'd fixed width text, https://blog.qiqitori.com/2023/03/ocring-hex-dumps-or-other-...

Basically it just clusters same characters and asks the human to find the problems, which is easy when you're looking at a series of pictures like ssssss5sss.

The UI is kinda least-effort. Should ask a modern AI agent to make it look nice and intuitive, sometime maybe.

DrewADesigntoday at 9:57 AM

> I guess Uniqlo is run through Windows though: one thing that struck me was the font, which I’m almost certain is Consolas,

Surely this would use whatever font the virtual terminal profile was set to? I don’t know of any method to choose a virtual terminal font from bash and don’t see any code that addresses it?

show 1 reply
_fluxtoday at 11:54 AM

On one hand it's nice how it's clean and commented, but on the other hand some golfing could have made the encoded block a lot more reasonable to actually manually enter.

show 2 replies
brightballtoday at 11:57 AM

Nice!

Might have to do something like that for a verse on the next Carolina Code Conference shirt. Been trying to figure out a good way to pull in cybersecurity.

sixtyjtoday at 11:58 AM

> Interesting. I told my wife "that’s basically how people ship viruses’ and bought it.

It’s a movie plot.

willejstoday at 11:59 AM

Looks like it has a few shellcheck issues, and no set -euo pipefail? ;)

preetham_rangutoday at 11:26 AM

The real threat model here isn't the base64 payload, it's Uniqlo turning a T-shirt into a QR code that requires a human OCR pipeline to redeem.

shim__today at 11:42 AM

Could have saved 50% with 'base64 -d | gzip -d'

show 1 reply
tantalortoday at 11:43 AM

TIL Consolas is a Windows font

dylanzhangdevtoday at 9:39 AM

Cool! I bought one a few months ago as soon as I spotted it at a Uniqlo store, and later ordered a larger size online—I really love wearing them. But it never occurred to me to look into the story behind them.

khurstoday at 10:45 AM

Brilliant marketing when you can get people to pay to walk around advertising with your logo!!

doppptoday at 10:11 AM

Thanks for the post! Love Easter Eggs like these!

kijintoday at 10:54 AM

Well at least they're not instructing consumers to run curl | bash.

That's better than half the tech howtos out there.

show 1 reply
brazzytoday at 10:34 AM

After being primed by the article, I read the author's name as "Shirtliker"...

show 1 reply
FijiBYtoday at 11:27 AM

Nice investigation, thx

l337h4x0rztoday at 10:18 AM

there's no newline between the shebang and the actual code

high_bytetoday at 9:26 AM

what if it contained a zero day for tesseract and the script you thought you got is just a throwaway

show 1 reply
icevltoday at 10:14 AM

Base64 without error correction turns the t-shirt itself into a lossy transport layer, so the OCR/transcription step becomes the actual challenge.

breppptoday at 11:03 AM

Feels very reminiscent of the style of old DeCSS tshirts

https://www.wired.com/2000/08/court-to-address-decss-t-shirt...

tancoptoday at 10:09 AM

[dead]

huflungdungtoday at 11:32 AM

[dead]

lloydatkinsontoday at 10:13 AM

P ./cool.sh: line 31: bc: command not found ./cool.sh: line 34: bc: command not found ./cool.sh: line 37: bc: command not found E ./cool.sh: line 31: bc: command not found ./cool.sh: line 34: bc: command not found ./cool.sh: line 37: bc: command not found

Very wow. Shame they assumed everyone has "bc"...

show 3 replies
bryanrasmussentoday at 9:21 AM

Why does the shirt have an obfuscated bash script on the back?

show 2 replies