Hello there, I'm a human who likes computers and math.
The open encrypted chat protocol
After years and years of talking about it, I've finally made it. Toechat is here, and it has been made with simplicity in mind from the start. In this short blog post, I'll explain how Toechat works under the hood. For implementation-specific details, please visit the repository.
Toechat can only do two things. Send text and send files, both wrapped in XChaCha20-Poly1305. To achieve this, the following header is used:
+-----+-----+-----+-----+-----+-----+-----+-----+
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| 0 | Text size | File size |
+-----+-----------+-----------------------------------+
| 1 | |
+-----+ |
| 2 | Cryptographic nonce |
+-----+ |
| 3 | |
+-----+-----------------------------------------------+
The text size must always be larger than 0. If the file size is 0, the data sent after the header is interpreted as a regular text message. If the file size is larger than 0, the text is interpreted as a file name and the received data is written to that file. In every case, the data is chunked with a maximum chunk size of 65535 bytes, followed by a 16-byte MAC. An 8-byte large chunk would look like this:
+-----+-----+-----+-----+-----+-----+-----+-----+
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| 0 | Chunk |
+-----+-----------------------------------------------+
| 1 | |
+-----+ Message authentication code |
| 2 | |
+-----+-----------------------------------------------+
And that's pretty much it. The decryption key used on messages must be shared outside of Toechat and peers must be tagged with a name manually. This improves security by making sure a bad actor can't impersonate a recipient. Connections to peers must also be set up manually, the protocol makes no attempt at opening connections automatically.
Why x86 is unfathomably bloated
Wouldn't it be interesting to count the percentage of the x86 ISA that a program uses? Well, first of all, we need to define what the term "instruction" even means when it comes to the behemoth that is x86. For a detailed explanation, I highly recommend reading this article. In this post, I'll follow XED's definition of an instruction, which is: Intel® XED classifies instructions as iclasses (ADD, SUB, MUL, etc.) of type xed_iclass_enum_t. All of these "iclasses" are defined inside xed-iclass-enum.h, turns out there are 1974 of them at the time of writing this post (ignoring XED_ICLASS_INVALID and XED_ICLASS_LAST).
Now, all we need to do is build XED, give it an executable and count the number of unique iclasses. The results below were attained using the following script (by default, XED decodes at most 100 million instructions, make sure to increase that limit if decoding a large file): xed -i file | awk '/^XDIS/ {list[$6]++} END {printf "%.2f%%\n", length(list) / 1974 * 100}'
- Hello world in C: 0.91%
- Busybox: 5.83%
- Tor: 5.93%
- Go: 10.59%
- LLVM: 13.12%
Turns out very few x86 instructions are actually used, to the point where even something as massive as LLVM only uses 259 out of 1974 instructions. This explains why x86 is so power-hungry compared to ARM or RISC-V.
Installing OpenWRT on a WD N600 router
According to the OpenWRT wiki, there are three tested methods to install OpenWRT on a WD N600 router. However, when I got my hands on one, neither method worked. Every time I tried to flash the factory image (version 24.10.0 at the time), the router's light would slowly turn on and off, as if the image was being flashed, but it would never stop. The router would get stuck and never reboot. After a couple hours of tears and frustration, I managed to figure out what the issue was. After giving the factory image a shorter name and following the wiki's first method, the router would successfully boot into OpenWRT.
Unfortunately, after restarting it using the on/off button, OpenWRT would disappear and I would be again greeted by the "Emergency room" interface. After a couple more hours of frustration, I managed to make the factory image stay by reflashing it using the sysupgrade image, combining the first and third methods from the wiki:
1. Download the factory image and rename it to something shorter, like openwrt-24.10.0.bin.
2. Change your computer's IP address to 192.168.1.10 and connect it to a LAN port on the router.
3. Turn off the router.
4. Use a paperclip to press and hold the reset button located on the bottom of the router. While holding the reset button, turn the router back on. Keep holding the reset button for at least 15 seconds. Wait until the power light on the front of the router starts flashing slowly.
5. Open a web browser and go to http://192.168.1.1.
6. Use the "Emergency room" interface to upload the factory image.
7. The router will take a few minutes to flash OpenWRT. Once it's finished, go back to http://192.168.1.1 and update the firmware with the sysupgrade image.
The mathematically perfect knife
A delicate and modest blade, meant to be gripped by two fingers, crafted from an interconnected symphony of equations, harmoniously dancing as one. Ponder its alluring splendor, and lose yourself in its enchanting beauty.
To start, simply choose one exercise from each progression category. The lower an exercise is listed, the harder it is. Assistance exercises aren't listed in any particular order, just pick one that helps you achieve your current goals. Once you can do 5 sets of 8-12 reps, move on to a more challenging variation.
PUSH (Monday, Thursday):
Dip progression:
- Bench dips
- Negative dips
- Full dips
- Single bar dips
- Ring dips
Push-up progression:
- Vertical push-ups
- Incline push-ups
- Knee push-ups
- Full push-ups
- Diamond push-ups
- Pseudo planche push-ups
- Uneven push-ups
- Archer push-ups
- One arm push-ups
Push assistance:
- Wall plank
- Wall handstand
- Freestanding handstand
- Parallel bar support hold
- Pike push-ups
- Elevated pike push-ups
- Triceps extensions
PULL (Toesday, Friday):
Pull-up progression:
- Jackknife pull-up
- Negative pull-ups
- Full pull-ups
- Narrow pull-ups
- One hand pull-ups
- Archer pull-ups
- One arm pull-ups
Row progression:
- Vertical rows
- Incline rows
- Horizontal rows
- Wide rows
- Archer rows
- One arm rows
Core progression:
- Hanging knee raises
- Hanging leg raises
- Toe to bars
LEGS (Wednesday, Saturday):
Squat progression:
- Assisted squats
- Full squats
- Narrow squats
- Uneven squats
- Assisted pistol squats
- Full pistol squats
Hinge progression:
- Glute ham raises
- Negative nordic curls
- Full nordic curls
Calve progression:
- Calve raises
- One leg calve raises