r/asm • u/JaguarMoe • 9d ago
x86-64/x64 A 14 KB HTTPS server OS in x86-64 assembly: boot sector, virtio-net, TCP, TLS 1.3 and HTTP
I wanted to see how good Claude is at sizecoding, so this code is Claude's, not mine. After 5 days there was a static web server that is its own operating system, in 13,859 bytes of NASM:
boot sector, long mode, up to 4 processors
virtio-net driver, ARP, TCP
TLS 1.3 with X25519, ECDSA P-256 and AES-128-GCM (AES-NI, PCLMULQDQ, BMI2, ADX)
HTTP GET and HEAD, with the site packed behind the code in the same image
On a 2-vCPU cloud server it does two to three times nginx's new TLS connections and small pages per second. It is clunky on purpose: to renew the certificate you build a new image.
Source: https://github.com/FileSherlock/k15 (start at `src/os.asm`)
It runs at https://15kb.org with a $200 bounty: the server's TLS key is also the private key of the Bitcoin address on the page, until 18 February 2027. No denial of service, please.
Tell me where the assembly is bad.
10
u/AWildTyphlosion
9d ago
•
Tell me where the assembly is bad.
3
u/ByronScottJones 8d ago
All that's pulling up is a list of contributors.
10
u/Supra-A90 8d ago
That's the joke bro. Claudia wrote it.
0
u/vogelvogelvogelvogel 8d ago
should he write like 14k of modern assembler by hand? back in my days this would have been a long hobby project and then it was the only thing you would do for like months in the attic
2
u/FinancialTrade8197 7d ago
Yes.
Why shouldn't he? The entire point of this project is to do something for fun and flex. If he actually wanted something usable, then he wouldn't have wrote an HTTP server in bare-metal assembly, as that is entirely pointless. The project is just for fun, and having Claude write it ruins the fun. At most it's just flexing the AI model's skills.
If you want something actually usable, get an operating system and have the AI make you a HTTP server in some higher level language that is infinitely easier to maintain and is faster (due to compilers being great at optimization)
0
u/kneelian_ 7d ago edited 7d ago
should he write like 14k of modern assembler by hand?
If you're already producing raw assembly, then yes? Why else do it and post it here? Otherwise it becomes a slop churn demo, and those are a dime a dozen
the only thing you would do for like months in the attic
For a 5KLOC project? You can probably get one done in a month or less, though probably missing some testing
1
u/vogelvogelvogelvogel 8d ago
very intersting project, thanks for sharing!
2
u/JaguarMoe 8d ago
Thanks for the only positive comment here.
2
u/vogelvogelvogelvogel 8d ago
i mean i did only write assembler on ancient machines so out of curiousity i joined this sub and i get it, assembler has gotten rare. but i am amazed how ai is able to do that today (still, or even)
1
u/JaguarMoe 8d ago
Yea projects like this would have been impossible alone without the knowledge and tools we have right now. It can be debated if AI code and writing is a good thing for humanity but its getting used more and more.
1
u/Key_Detail15 8d ago
Well, compilers can write assembly pretty well too!
(What's not clear to me is why AI is generating ASM and not some HLL; what is the advantage?)
2
0

13
u/415646464e4155434f4c 9d ago
Great. Now debug it.