Top
Best
New

Posted by speerer 8 hours ago

Decoding the obfuscated bash script on a Uniqlo t-shirt(tris.sherliker.net)
1029 points | 176 comments
estebarb 5 hours ago|
"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.

_joel 3 hours ago||
Worked on my torso
noisy_boy 2 hours ago|||
- I am shell-shocked at the lack of quality assurance! Can you at least apply a patch?
entropie 2 hours ago|||
Patch could be applied via pants.
alentred 1 hour ago|||
- Sure, we distribute a patch, you hot-fix it.
cromka 5 hours ago|||
Oh the Karens these days!
Octoth0rpe 4 hours ago||
Surely such a person would use the spelling k@r3n
basilikum 29 minutes ago||
K4R311
NoSalt 1 hour ago||
Spite
olooney 4 hours ago||
If you enjoy this kind of thing, you might also like Martin Kleppe's work, such as the Quine Clock:

https://aem1k.com/qlock/

I reverse engineered it to a unobfuscated version a few years ago:

https://gist.github.com/olooney/a89db3932b089925b71b68d7e9f2...

He's done a ton of other great ASCII visualizations as well:

https://aem1k.com/

esquivalience 1 hour ago|
This is really cool, and I appreciated your reverse engineering.
raphlinus 4 hours ago||
The font is Roboto Mono, not Consolas.

There's something else a lot stranger going on, though. It is a proper monospace font, but the typesetting on the shirt is not. There's some kerning going on (I noticed it especially in the 'Iy' pair), and also it appears that narrower characters such as 'i' take less horizontal space. If I had to guess, I would say that it was set with a tool such as "optical kerning" in InDesign.

somat 3 hours ago||
Has anyone ever made a monospace font with dynamic kerning? Which is a silly thing I never thought of until I read the above comment. This sounds nonsensical at first glance(and it may be) but hear me out.

We use monospace fonts for a reason, they stack in a grid nicely. But within the confines of that grid there is room to shift a character left or right a bit which may lead to a nicer to read monospace. (it is equally likely to lead to a hideous mess, every time a letter would shift left it would leave a larger space right)

roblabla 3 hours ago|||
Monaspace has a feature called "texture healing" that does something similar: it allows bigger letters to "steal" space from adjascent smaller letters, to make it easier to read. The result is that the letters are still in a grid, while still allowing for bigger letters to "breathe".

https://github.com/githubnext/monaspace/blob/main/docs/Textu...

It's the main reason I use monaspace as a font.

bityard 47 minutes ago|||
I'm open to trying it, but my gosh, having one 'w' offset slightly by a few pixels from the one right above it feels like it would drive me bonkers eventually.

And: doesn't this result in text that "jumps around" as you type?

gavinray 2 hours ago|||
What a brilliant idea, neat. Thanks for the link.
Lalabadie 2 hours ago||||
iA Writer has Mono, Duo and Quattro fonts, with the latter two being almost monospaced. They concede some size variations for specific characters (Duo has 150% width characters, Quattro also uses 50% and 75% for narrow characters).

It's a fun subtle adaptation to keep close to the typewriter-like experience of the app.

https://ia.net/topics/a-typographic-christmas

kccqzy 2 hours ago|||
Shifting a letter left or right a bit can break the grid. What if the user writes the text that keeps triggering left shifts? A better solution is to use ligatures, so that specific character combinations look better while the ligature can maintain the overall width correctly.
speerer 2 hours ago||
Thank you, I think you're right! I've added a correction in the post and cited your comment.
wbh1 6 hours ago||
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
criddell 4 hours ago||
It would probably be quicker to type it in than figure out how to OCR it. It would be like typing in a game from a COMPUTE! magazine 45 years go.

https://archive.org/details/1983-01-compute-magazine/page/96...

fennecfoxy 1 hour ago|||
But it's not hard to OCR? And I don't know why the article dedicates an entire section to it.

On a Samsung S24U I held down the "circle to search" homescreen button which brings up the AI tools interface (I don't know what it's officially called), held down on the text and copied the whole thing in one shot.

It took like 2 seconds.

kyusan0 1 hour ago||
Did it get every character correct?
speerer 6 hours ago|||
Author here. Thank you so much for the link which I hadn't seen! I'm very happy to see this and I'm gratified that it was deliberately difficult to OCR, not just me.
VladVladikoff 2 hours ago||
I watched the link but I didn’t see where he talked about making it difficult to OCR? What exactly was done that made it difficult to OCR?
Tiberium 8 hours ago||
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 :)

grumbelbart2 4 hours ago||
> OCRing this is a nightmare and is a good benchmark to any self-proclaimed good OCR/vision model.

It's not that difficult, our industrial OCR model read it correctly on its first attempt with default parameters. The characters are easily separable, there is no structured background (think expiration dates on yogurt aluminum lids) that confuses the reader, there is no almost-text-like texture anywhere that would clutter the result. The font is also nice and standard.

lemagedurage 7 hours ago|||
I don't think it was written by an LLM, some things stand out:

The congratulations text is both in English and Japanese. Contains a single heart emoji.

There was an intention to have a cyan to orange gradient, but the range starts in an ANSI block, ends halfway through the 256 color block and 256 terminal colors are not arranged like a gradient at all.

There's no sleep at the end of the loop where I feel like an LLM would add that defensively.

n2j3 6 hours ago|||
Human here. I added a sleep 0.5 at the end, it's too fast to read otherwise. Makes for a nice terminal screensaver!
INTPenis 6 hours ago||
Hi fellow human, I got the same idea. Just a sleep 0.1 before the echo "" makes it readable. Otherwise it scrolls way too fast.
make3 6 hours ago|||
"the code is not quite detail oriented enough to be AI", times are changing
pkilgore 3 hours ago|||
Flawless, completely unnecessary abstraction is a better tell of LLM code than "comment clearly responding to a part of a prompt that I cannot see".
DaSHacka 6 hours ago||||
More like 'not boilerplate-y enough'
lemagedurage 6 hours ago|||
Ehh, AI makes plenty mistakes but they have a different vibe to it.

In my mind an AI would do something the most popular way even when that's not appropriate.

A human might do things in an unpopular way even when that's not appropriate.

netsharc 6 hours ago|||
The last time Internet people were obsessed with OCRing some base64 was a few months ago when the DoJ released tons of emails from some guy who died, but they were released as rasterized PDFs.

Can't remember his name now, there's been so many distractions...

OtherShrezzing 6 hours ago|||
Safari's copy-text-from-image feature manages the entire base64 part of the string, except for the first character (I instead of a T). Weirdly, it gets much worse performance if you try to copy the entire string, including the hashbang part.

I wonder what it's doing under the hood to get such good performance?

khurs 6 hours ago||
Didn't know Safari had this.

Looked it up, you put mouse over text, then just select and copy it - very cool!

https://support.apple.com/en-gb/guide/safari/ibrw20183ad7/ma...

al_borland 4 hours ago|||
It’s actually a system feature, not strictly a Safari feature. It also works in Photos, Preview, etc.

On meetings I will often take a screenshot of the URL someone is presenting. I’m then able to just open the image and click the URL in the image.

iamflimflam1 6 hours ago||||
There’s a whole bunch of hidden features that no one seems to be aware of.

Preview has pretty good background removal.

Notes will transcribe audio from audio files.

al_borland 4 hours ago|||
Notes will do OCR as well. Trigger the feature, point the camera at something, and it will input just the text.
lostlogin 3 hours ago||
Notes is amazing. Autocompleting equations, converting jpg to pdf and various other admin chores.

The seamless cloud sync between devices is much appreciated too.

agys 6 hours ago|||
Preview has it too… And it works extremely well.
underyx 5 hours ago|||
I gave the photo to Opus 4.8 and it reconstructed the same script in one shot. Although it did say it had to correct some parts of it based on context where it suspected OCR mistakes.
fennecfoxy 1 hour ago|||
Is it? Android tap and hold/image text select one-shotted it in 2 seconds.
shakna 6 hours ago|||
> I wonder if the script itself was written by an LLM before obfuscation?

From the prototype shown here [0], and the way they talk about their process, I sincerely doubt it. Especially as they mention trying to make it hard for AI to handle the output.

[0] https://youtu.be/jocGLiecpjU?t=567

cb321 5 hours ago||
I watched that whole video link - thank you for that - and he doesn't really say. In fact, he spends much more time on the beige color harkening to computer case plastics of the 80s & 90s.

The AI not handling the output relates to the final base64 output on the T-shirt (which other comments in this thread mention manually keying in or TFA discusses in the context of OCR). So, that is just not relevant to the question.

What made me start to wonder, personally, was that the output seems identical if you use "♥PEACE♥FOR♥ALL" instead of the version with internal repeats. IF there is any point to that "manual expansion of the cycles", IMO that deserves a comment much more so than "# Calculate length of text; text_length=".

Also, that `echo -n ...` followed by `echo ""` instead of just plain `echo` in the first place seems like the kind of copy-pasta code LLMs generate. Then again, regular devs also write pretty bad copy-pasta code.

There is also this the weirdly "broken down" calculation with 3 `bc` invocations not 1 as if it was translated from a language with more arithmetic/special function power than bash.

There is also the color scale stuff done in the loop instead of outside (except the one color=$(..)) which seems very unnatural and also very like machine translation.

Also, at least for me, on my bash-5.3.15(1), `char="${text:t % text_length:1}"` does not work to slice out the multi-byte UTF8 heart symbols, but it sure does look like the kind of thing an LLM would do translating from a python3 script (such as something like https://news.ycombinator.com/item?id=48830669) into bash.

Another thing is, as others here have observed, there is nothing "gradual" about the xterm-256 color cube. So, "gradient" is a misnomer and exactly the kind of weird things LLMs do when they cobble text together.

Finally, all the tput stuff the script does instead of just "print x spaces" really smells like a human description of the side scroll in the video game graphic he shows inspired him somehow LLM-corrupted/complexified into the vertical scroll terminals do.

None of this is conclusive, but the video mentions 2023..2025 as when he did it and given that he was a designer and his concerns more visual than code-oriented, I'd have to say I disagree with your sincere doubt and I do strongly suspect the decoded script was very likely LLM-circa2024-generated, possibly with light post-edits by hand.

shakna 4 hours ago||
You mention someone else's Python version. Did you note that the prototype in the video was... Python?

All the smells you pointed out, just look like a Python dev approaching bash without fully understanding it.

bigfishrunning 4 hours ago|||
> All the smells you pointed out, just look like a Python dev approaching bash without fully understanding it.

also, referring to Linux as "the language of the internet" when bash isn't particularly suited for internet tasks also smell like "excited windows Python dev"...

cb321 3 hours ago||
FWIW, his screens looked a lot like OSX to me (which tracks with graphic design users in my experience).

Anyway, he seems like a very nice fellow and I wish him and almost all T-shirt designers well. That bash script just gave me a lot of pause. (And even that seems possibly downstream of him being nice and doing it himself to spare his team from what he called a "FrankenProject".)

cb321 3 hours ago|||
Yeah. The Flask web-page prototype was indeed in Python. (The prequel shirt was Go.)

{ Also, it was my own Py version which I mostly did in case anyone wanted to actually run the thing after such interest was expressed on this thread. :-) }

I already said regular devs and LLMs can both gen copy-pasta. That said, being "mostly" a Python dev, asking some LLM to translate to bash for him seems even more likely to me. Only he or those close to him knows for sure. You & I cannot settle it here conclusively (as also said).

I also noted from the video that the ♥s (hearts) worked on whatever version of bash he tested with though it failed for me (which is why I wrote that Python). And his terminal title bar is switching between `tput` and `bc` and such meaning that what he was demoing was not some Python script. ¯\_(ツ)_/¯

EDIT: Ah..another resolution of the hearts is to not run in an LC_ALL=C environment. Oops! `LC_ALL=en_US.UTF-8 bash ..` fixed it. Oh well, I think the Python script is nicer in almost every way. E.g., you could |head -n60 and send it to a line printer/dot matrix reminiscent of the 1980s computers he shows in the video, although your printer driver would have to strip the color escapes with a `sed` or maybe https://github.com/c-blake/bu/blob/main/noc.nim. ;-)

ErroneousBosh 2 hours ago|||
Those of us who grew up in the 8-bit era would have just typed it in, carefully, in silence, with no-one allowed to enter or leave the room until we were done ;-)
justusthane 4 hours ago|||
What is it about this that makes it particularly hard to OCR?
da_grift_shift 5 hours ago|||
>I wonder if the script itself was written by an LLM before obfuscation?

I seem to recall seeing an Akamai-branded base64'd shell script on a white shirt pre-2021(?), so unless they've changed the code since then, I doubt it...

IshKebab 7 hours ago||
Definitely LLM. No humans write that many comments.
ChrisMarshallNY 7 hours ago|||
Ahem...

My code usually clocs at 50/50 (or thereabouts)[0]. Has, since my very first real engineering project (in 1987)[1]. I discuss in detail, here[2].

But one reason that I like LLMs, is that they help me to write even more documentation. I have found that I can instruct an LLM to revise my documentation, and make it even more effective.

[0] https://github.com/ChrisMarshallNY (My GH profile. Pretty much everything there, is like that -has, since long before LLMs were a broken rubber on the drug store shelf).

[1] https://littlegreenviper.com/wp-content/uploads/2022/07/TF30... (Downloads a PDF)

[2] https://littlegreenviper.com/leaving-a-legacy/

IshKebab 2 hours ago||
Your code isn't as unnecessarily commented as this. E.g. look at this line

https://github.com/RiftValleySoftware/RVS_Spinner/blob/d44ee...

An LLM would have commented `// Create temporary UI view.`

Completely redundant comments like this are a classic hallmark of LLMs:

  # Set frequency scaling factor
  freq=0.2
Dunno why I have been downvoted for stating the obvious.

Also from my brief look at one file it looks like you have 50% comments because you have a gazillion comment separator lines.

ChrisMarshallNY 1 hour ago||
I didn't downvote. There's nothing wrong with your comment. It's just a bit silly, because humans definitely write that much. I learned from Apple and Adobe headerdocs.

I worked for a Japanese company that accreted comments.

Yeah, lots of whitespace.

petu 7 hours ago||||
Human could write that many comments to get enough base64 text for a design. Maybe to even get some of the highlighted characters in places they want (roughly equally spaced apart).
ivolimmen 4 hours ago||||
Since LLM's are mimicking our code my guess we do...
latexr 7 hours ago||||
> No humans write that many comments.

Especially in a case like this, I would definitely write a lot of comments to aid in understanding, thus increasing trust so people would try it out and tinker with it.

boomboomsubban 6 hours ago||
Plus the main point of this code is to have people look at it, the function is secondary to being an easter egg.
NamlchakKhandro 3 hours ago||||
I do
Tiberium 7 hours ago|||
Honestly it's a bit of a shame. I checked and they could've shortened their base64 payload by 304 chars by removing all comments except the top two congratulatory ones, or by 524 if they removed those too.
OtherShrezzing 7 hours ago|||
Would they still get the highlighted "PEACE FOR ALL" text throughout the shortened string? It looks like the length, and presence of those characters, was an explicit design choice.
lemagedurage 6 hours ago||||
Maybe they added the comments to get a longer payload for the sake of the shirt's design.

The comments can be more cute/awe inspiring for people who aren't as familiar with bash but like solving puzzles as well.

yborg 6 hours ago||||
The HN optimizing T-shirt compiler is the next stage here :D
saidnooneever 7 hours ago|||
im just sad it didnt render a qr code leading to malware :'). the different ways ppl look at obfuscated codes and scripts hah
world2vec 7 hours ago||
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.
actionfromafar 6 hours ago|
An easy miss. :-) Most of the time our thoughts are on autopilot, since we are not calm.
mk_stjames 3 hours ago||
Neat. My only critique of the script is that I would have added a

  sleep 0.1 
in the loop so that as this prints in a terminal it is actually readable; any modern terminal will scroll so fast you can't see the message in flight.

Slowing it to a 10hz refresh makes it look great.

whartung 3 hours ago|
Maybe you can sew a patch into it?
nico 2 hours ago||
Very cool. It reminded me of the DeCSS t-shirts, which had source code with the decryption keys for DVDs

https://en.wikipedia.org/wiki/DeCSS

haileys 7 hours ago||
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
christoph 7 hours ago||
That was also my thought… but I grew up mashing rubber keys for hours copying “games” out of magazines and books! Then hours after fixing all the typos!
forinti 4 hours ago||
I spent hours typing 6502 assembly. It went a lot better when someone dictated: LDA, STA, BEQ, LDY, STY...
acters 6 hours ago|||
I ran it through paddle paddle OCR and it flawlessly did it. Google's OCR through my phone's Google lens had also worked at getting a very good extraction but not 100% correct. Definitely would spend less time fixing it than hand copying.

IDK what the author was using but I feel like he could have shared how his OCR attempt went, but I am thinking he tried some naive OCR tools.

speerer 6 hours ago||
Author here - that's a good idea actually, it shouldn't be too hard to compare the various attempts. The tools I used were whatever my Android built-in is (likely Google Gemini, but I can't tell whether this is something Samsung has replaced in OneUI); tesseract; tesseract with various tweaks and charsrt restrictions; Claude; and finally, manual fixes based on disagreements between all the previous.
rtldg 7 hours ago|||
Took me almost 2 minutes for 4 lines (and I missed a character in one of them!). I would opt for OCR too, obviously so I'm prepared for the next bash t-shirt I'd come across...
OtherShrezzing 6 hours ago||
I think this is a case where two people can successfully complete the task manually faster than one attempting to automate it. Get a ruler, read five centimetres of characters to your colleague, have them type it in as you go, then repeat that five centimetres back to you. Correct as you go. Format your string with the same line-breaks as the t-shirt, and remove them at the end, so you can be sure you've got the correct length on each row. Trial-and-error adjust the five-cm distance depending on your success rate as you go along

All in, you should have a non-corrupted string in 10-15 min.

conductr 3 hours ago|||
Feels like my experienced reality of task automation in corporate environments. We routinely have engineers spend 40+ hours automating tasks that an entry level person can do manually in 10 minutes and only need to be done weekly. Automation at all costs seems to be the future
e28eta 2 hours ago||
It’s certainly not a new phenomenon. I appreciate this XKCD [1], with a chart of “How long can you work on making a routine task more efficient before you’re spending more time than you save”

It’s not the final word, since automation has other benefits: documenting the procedure’s steps, reducing human errors, increasing consistency, etc.

1: https://xkcd.com/1205/

grumbel 6 hours ago|||
Gemini3.5 Flash didn't have a problem OCR'ing and base64 decoding it, despite the OCR step having errors, it just fixed them in the base64 decoding step.
mayas_ 7 hours ago|||
"just typing it" would be more error prone for the average human
speerer 6 hours ago|||
(Author here) Yes I agree. It was a fun side-quest though. Reminds me of https://xkcd.com/1205/
duskdozer 7 hours ago||
I'm guilty of this, but for me this kind of thing is optimizing over annoyance rather than time.
chrysoprace 6 hours ago|
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

mdgld 6 hours ago||
I wasn’t sure if you meant a Go solver or Go the language. Would be fun if someone wrote a Go program in Go
psd1 5 hours ago||
Or a pong clone in Racket.
ExoticPearTree 6 hours ago||
I got one this year with the Go code. Never actually thought it is legit code, just some random stuff.
More comments...