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.
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}'
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.
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:
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.
All of them are awesome, give them some love:
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:
Push-up progression:
Push assistance:
PULL (Toesday, Friday):
Pull-up progression:
Row progression:
Core progression:
LEGS (Wednesday, Saturday):
Squat progression:
Hinge progression:
Calve progression: