<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
  <title>ozdc.us</title>
  <link>https://ozdc.us/</link>
  <description>reverse engineering &amp; security notes</description>
  <language>en</language>
  <managingEditor>ozdc@ozdc.us (Can Ozdemir)</managingEditor>
  <copyright>© 2026 Can Ozdemir. All rights reserved.</copyright>
  <item>
    <title>First look at an unknown file, safely</title>
    <link>https://ozdc.us/p/first-look-at-an-unknown-file/</link>
    <guid isPermaLink="true">https://ozdc.us/p/first-look-at-an-unknown-file/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Fri, 16 Oct 2026 00:00:00 +0000</pubDate>
    <category>triage</category>
    <category>malware-analysis</category>
    <category>tutorial</category>
    <description>&lt;p&gt;Someone sends you a file and asks &amp;quot;what is this?&amp;quot;. The first ten minutes are about learning as much as possible &lt;strong&gt;without running it&lt;/strong&gt;. This post is a checklist for that static triage.&lt;/p&gt;
&lt;h2 id=&quot;rule-zero-where-you-work&quot;&gt;Rule zero: where you work&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Work in a &lt;strong&gt;virtual machine&lt;/strong&gt; with no shared folders and no clipboard sharing, and take a snapshot first so you can roll back.&lt;/li&gt;&lt;li&gt;Turn off networking, or use a host-only network, unless you deliberately want to see what the file talks to.&lt;/li&gt;&lt;li&gt;Never double-click. Don&amp;#039;t open documents in a normal office suite either: macros and exploits are the point of many malicious files.&lt;/li&gt;&lt;li&gt;Keep samples zipped with a password (&lt;code&gt;infected&lt;/code&gt; is the common convention) when moving them around, so nothing opens them by accident.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;None of the steps below execute the file. They only read it.&lt;/p&gt;
&lt;h2 id=&quot;1-fingerprint-it&quot;&gt;1. Fingerprint it&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;sha256sum sample.bin&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The hash identifies the file exactly. Write it in your notes. Searching for the hash (not uploading the file) on public threat-intelligence sites often tells you instantly whether it&amp;#039;s known. Uploading a file can reveal to its author that someone is looking, so think before you do that.&lt;/p&gt;
&lt;h2 id=&quot;2-what-type-is-it-really&quot;&gt;2. What type is it really?&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;file sample.bin&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;file&lt;/code&gt; ignores the extension and looks at the content, mostly the first bytes. Common signatures are worth knowing by sight:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;7f 45 4c 46&lt;/code&gt; (&lt;code&gt;.ELF&lt;/code&gt;): Linux executable or library&lt;/li&gt;&lt;li&gt;&lt;code&gt;4d 5a&lt;/code&gt; (&lt;code&gt;MZ&lt;/code&gt;): Windows executable (PE)&lt;/li&gt;&lt;li&gt;&lt;code&gt;50 4b 03 04&lt;/code&gt; (&lt;code&gt;PK&lt;/code&gt;): ZIP, which includes &lt;code&gt;.docx&lt;/code&gt;, &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.jar&lt;/code&gt; and &lt;code&gt;.apk&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;25 50 44 46&lt;/code&gt; (&lt;code&gt;%PDF&lt;/code&gt;): PDF&lt;/li&gt;&lt;li&gt;&lt;code&gt;23 21&lt;/code&gt; (&lt;code&gt;#!&lt;/code&gt;): a script with an interpreter line&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;A file called &lt;code&gt;invoice.pdf&lt;/code&gt; that starts with &lt;code&gt;MZ&lt;/code&gt; has told you most of what you need.&lt;/p&gt;
&lt;h2 id=&quot;3-strings&quot;&gt;3. Strings&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;strings -n 6 sample.bin | less
strings -n 6 -e l sample.bin | less     # UTF-16LE, common in Windows programs&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Look for URLs, IP addresses, file paths, registry keys, error messages, user agents, and names of libraries or functions. Strings are cheap clues, but treat them as hints: they can be planted to mislead, and important ones are often encrypted.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Strings&lt;/strong&gt; tab on this site does the same thing for each page: press &lt;code&gt;s&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;4-structure&quot;&gt;4. Structure&lt;/h2&gt;
&lt;p&gt;For ELF files:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;readelf -h sample.bin        # header: 32/64-bit, CPU, entry point
readelf -l sample.bin        # segments and their permissions
readelf -d sample.bin        # needed libraries
readelf -Ws --dyn-syms sample.bin   # imported and exported symbols&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For PE files, tools like &lt;code&gt;pefile&lt;/code&gt; (Python), PE-bear or Detect It Easy show the same things: sections, imports, timestamps and resources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Imports&lt;/strong&gt; are especially telling. A program that imports networking, process-creation and registry functions can do those things; one that imports almost nothing may be packed and resolve its functions at run time.&lt;/p&gt;
&lt;h2 id=&quot;5-entropy-is-it-packed&quot;&gt;5. Entropy: is it packed?&lt;/h2&gt;
&lt;p&gt;Compressed or encrypted data looks random. A section with entropy close to 8 bits per byte, a tiny import table and few readable strings usually means the real code is packed and unpacked in memory. &lt;code&gt;binwalk -E sample.bin&lt;/code&gt; plots entropy across the file, and Detect It Easy reports it per section and often names the packer.&lt;/p&gt;
&lt;h2 id=&quot;6-write-it-down&quot;&gt;6. Write it down&lt;/h2&gt;
&lt;p&gt;Before moving on to disassembly or a sandbox, write a short summary: hash, real type, architecture, notable strings, imports, packed or not, and your best guess about what it is. It forces you to separate what you &lt;strong&gt;know&lt;/strong&gt; from what you &lt;strong&gt;suspect&lt;/strong&gt;, and it&amp;#039;s the note you&amp;#039;ll want in six months.&lt;/p&gt;
&lt;h2 id=&quot;next-steps&quot;&gt;Next steps&lt;/h2&gt;
&lt;p&gt;Only after this do you open it in a disassembler (IDA, Ghidra, Binary Ninja, radare2) or run it in an isolated sandbox to watch its behaviour. Static triage tells you where to look, so those steps go much faster.&lt;/p&gt;</description>
  </item>
  <item>
    <title>From C to x86-64: reading a compiled loop</title>
    <link>https://ozdc.us/p/from-c-to-x86-64/</link>
    <guid isPermaLink="true">https://ozdc.us/p/from-c-to-x86-64/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate>
    <category>x86-64</category>
    <category>assembly</category>
    <category>tutorial</category>
    <description>&lt;p&gt;The fastest way to get comfortable reading disassembly is to compile code you already understand and compare the two. Here is a function that adds up an array of integers:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;c&quot;&gt;&lt;code&gt;int sum(const int *a, int n)
{
    int s = 0;
    for (int i = 0; i &amp;lt; n; i++)
        s += a[i];
    return s;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All the listings below are real &lt;code&gt;objdump -d -M intel&lt;/code&gt; output from GCC 13 on Linux.&lt;/p&gt;
&lt;h2 id=&quot;the-calling-convention&quot;&gt;The calling convention&lt;/h2&gt;
&lt;p&gt;On Linux and macOS, x86-64 uses the &lt;strong&gt;System V ABI&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;integer and pointer arguments arrive in &lt;code&gt;rdi&lt;/code&gt;, &lt;code&gt;rsi&lt;/code&gt;, &lt;code&gt;rdx&lt;/code&gt;, &lt;code&gt;rcx&lt;/code&gt;, &lt;code&gt;r8&lt;/code&gt;, &lt;code&gt;r9&lt;/code&gt;, in that order&lt;/li&gt;&lt;li&gt;the return value goes in &lt;code&gt;rax&lt;/code&gt; (or its low 32 bits, &lt;code&gt;eax&lt;/code&gt;, for an &lt;code&gt;int&lt;/code&gt;)&lt;/li&gt;&lt;li&gt;&lt;code&gt;rbx&lt;/code&gt;, &lt;code&gt;rbp&lt;/code&gt; and &lt;code&gt;r12&lt;/code&gt; to &lt;code&gt;r15&lt;/code&gt; must be preserved by the function; the others may be overwritten freely&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;So for &lt;code&gt;sum&lt;/code&gt;: &lt;code&gt;a&lt;/code&gt; is in &lt;code&gt;rdi&lt;/code&gt;, &lt;code&gt;n&lt;/code&gt; is in &lt;code&gt;esi&lt;/code&gt; (the low half of &lt;code&gt;rsi&lt;/code&gt;, because &lt;code&gt;int&lt;/code&gt; is 32 bits), and the answer ends up in &lt;code&gt;eax&lt;/code&gt;. Windows uses a different convention (&lt;code&gt;rcx&lt;/code&gt;, &lt;code&gt;rdx&lt;/code&gt;, &lt;code&gt;r8&lt;/code&gt;, &lt;code&gt;r9&lt;/code&gt;), so always check the platform first.&lt;/p&gt;
&lt;h2 id=&quot;o0-everything-on-the-stack&quot;&gt;-O0: everything on the stack&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;asm&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;0000:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;endbr64&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0004:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;push&lt;/span&gt;   &lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0005:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;rsp&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0008:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;QWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x18&lt;/span&gt;], &lt;span class=&quot;rg&quot;&gt;rdi&lt;/span&gt;    &lt;span class=&quot;cm&quot;&gt;; save a&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;000c:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x1c&lt;/span&gt;], &lt;span class=&quot;rg&quot;&gt;esi&lt;/span&gt;    &lt;span class=&quot;cm&quot;&gt;; save n&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;000f:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x8&lt;/span&gt;], &lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;     &lt;span class=&quot;cm&quot;&gt;; s = 0&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0016:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x4&lt;/span&gt;], &lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;     &lt;span class=&quot;cm&quot;&gt;; i = 0&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;001d:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jmp&lt;/span&gt;    003c                         &lt;span class=&quot;cm&quot;&gt;; jump to the loop test&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;001f:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x4&lt;/span&gt;]     &lt;span class=&quot;cm&quot;&gt;; eax = i&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0022:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;cdqe&lt;/span&gt;                                &lt;span class=&quot;cm&quot;&gt;; sign-extend i to 64 bits&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0024:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;lea&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rdx&lt;/span&gt;, [&lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;*&lt;span class=&quot;nu&quot;&gt;4&lt;/span&gt;+&lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;]             &lt;span class=&quot;cm&quot;&gt;; rdx = i * sizeof(int)&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;002c:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;QWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x18&lt;/span&gt;]    &lt;span class=&quot;cm&quot;&gt;; rax = a&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0030:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;add&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;rdx&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; rax = &amp;amp;a[i]&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0033:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;]         &lt;span class=&quot;cm&quot;&gt;; eax = a[i]&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0035:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;add&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x8&lt;/span&gt;], &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;     &lt;span class=&quot;cm&quot;&gt;; s += a[i]&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0038:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;add&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x4&lt;/span&gt;], &lt;span class=&quot;nu&quot;&gt;0x1&lt;/span&gt;     &lt;span class=&quot;cm&quot;&gt;; i++&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;003c:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x4&lt;/span&gt;]
&lt;span class=&quot;ad&quot;&gt;003f:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;cmp&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x1c&lt;/span&gt;]    &lt;span class=&quot;cm&quot;&gt;; i &amp;lt; n ?&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0042:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jl&lt;/span&gt;     001f                         &lt;span class=&quot;cm&quot;&gt;; yes: loop again&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0044:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;&lt;span class=&quot;nu&quot;&gt;-0x8&lt;/span&gt;]     &lt;span class=&quot;cm&quot;&gt;; return s&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0047:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;pop&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rbp&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0048:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;ret&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Things to notice:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;push rbp&lt;/code&gt; / &lt;code&gt;mov rbp, rsp&lt;/code&gt; is the classic &lt;strong&gt;prologue&lt;/strong&gt;. It sets up &lt;code&gt;rbp&lt;/code&gt; as a fixed reference point, so every local variable has a fixed offset from it.&lt;/li&gt;&lt;li&gt;Each C variable has a home on the stack: &lt;code&gt;a&lt;/code&gt; at &lt;code&gt;rbp-0x18&lt;/code&gt;, &lt;code&gt;n&lt;/code&gt; at &lt;code&gt;rbp-0x1c&lt;/code&gt;, &lt;code&gt;s&lt;/code&gt; at &lt;code&gt;rbp-0x8&lt;/code&gt;, &lt;code&gt;i&lt;/code&gt; at &lt;code&gt;rbp-0x4&lt;/code&gt;. Naming these slots is the first thing to do in any -O0 function.&lt;/li&gt;&lt;li&gt;The loop is compiled &amp;quot;upside down&amp;quot;: a jump straight to the &lt;strong&gt;test&lt;/strong&gt; at the bottom, the &lt;strong&gt;body&lt;/strong&gt; above it, and a backwards conditional jump (&lt;code&gt;jl&lt;/code&gt;). A backwards jump is almost always a loop.&lt;/li&gt;&lt;li&gt;&lt;code&gt;jl&lt;/code&gt; is a &lt;strong&gt;signed&lt;/strong&gt; comparison (&amp;quot;jump if less&amp;quot;), which tells you &lt;code&gt;i&lt;/code&gt; and &lt;code&gt;n&lt;/code&gt; are signed ints. Unsigned code would use &lt;code&gt;jb&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;&lt;code&gt;endbr64&lt;/code&gt; is a marker for Intel CET (control-flow protection), not part of the logic.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;o1-registers-and-a-pointer-walk&quot;&gt;-O1: registers and a pointer walk&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;asm&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;0000:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;endbr64&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0004:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;test&lt;/span&gt;   &lt;span class=&quot;rg&quot;&gt;esi&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;esi&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; n &amp;lt;= 0 ?&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0006:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jle&lt;/span&gt;    &lt;span class=&quot;nu&quot;&gt;0025&lt;/span&gt;                         &lt;span class=&quot;cm&quot;&gt;; then return 0&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0008:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;rdi&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; p = a&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;000b:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;movsxd&lt;/span&gt; &lt;span class=&quot;rg&quot;&gt;rsi&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;esi&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; n as 64-bit&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;000e:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;lea&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rcx&lt;/span&gt;, [&lt;span class=&quot;rg&quot;&gt;rdi&lt;/span&gt;+&lt;span class=&quot;rg&quot;&gt;rsi&lt;/span&gt;*&lt;span class=&quot;nu&quot;&gt;4&lt;/span&gt;]             &lt;span class=&quot;cm&quot;&gt;; end = a + n&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0012:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;edx&lt;/span&gt;, &lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; s = 0&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0017:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;add&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;edx&lt;/span&gt;, &lt;span class=&quot;kw&quot;&gt;DWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;]         &lt;span class=&quot;cm&quot;&gt;; s += *p&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0019:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;add&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;, &lt;span class=&quot;nu&quot;&gt;0x4&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; p++&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;001d:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;cmp&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rax&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;rcx&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; p != end ?&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0020:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jne&lt;/span&gt;    &lt;span class=&quot;nu&quot;&gt;0017&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0022:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;rg&quot;&gt;edx&lt;/span&gt;                     &lt;span class=&quot;cm&quot;&gt;; return s&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0024:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;ret&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;0025:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;edx&lt;/span&gt;, &lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;002a:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jmp&lt;/span&gt;    &lt;span class=&quot;nu&quot;&gt;0022&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The optimiser rewrote the loop. There is no &lt;code&gt;i&lt;/code&gt; any more: it walks a pointer from &lt;code&gt;a&lt;/code&gt; to &lt;code&gt;a + n&lt;/code&gt; and stops when they meet. It also moved the &lt;code&gt;n &amp;lt;= 0&lt;/code&gt; check out front, so the loop body is just four instructions. The stack frame is gone, because nothing needs to live in memory.&lt;/p&gt;
&lt;p&gt;This is what real-world binaries look like. The trick is to recognise the &lt;strong&gt;shape&lt;/strong&gt;: one register that steps by 4 each time and is compared with an end pointer is &amp;quot;iterate over an int array&amp;quot;, whatever the source code said.&lt;/p&gt;
&lt;h2 id=&quot;habits-that-help&quot;&gt;Habits that help&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Find the arguments first (&lt;code&gt;rdi&lt;/code&gt;, &lt;code&gt;rsi&lt;/code&gt;, …), then the return value (&lt;code&gt;eax&lt;/code&gt; just before &lt;code&gt;ret&lt;/code&gt;).&lt;/li&gt;&lt;li&gt;Name every stack slot and register as soon as you know what it holds. IDA and Ghidra both let you rename (&lt;code&gt;n&lt;/code&gt; in IDA).&lt;/li&gt;&lt;li&gt;Backwards jumps are loops. Look at the compare just before them to find the condition.&lt;/li&gt;&lt;li&gt;Watch for signed vs unsigned jumps: &lt;code&gt;jl/jg&lt;/code&gt; vs &lt;code&gt;jb/ja&lt;/code&gt;.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;do-it-yourself&quot;&gt;Do it yourself&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;gcc -O0 -c sum.c &amp;amp;&amp;amp; objdump -d -M intel sum.o
gcc -O2 -c sum.c &amp;amp;&amp;amp; objdump -d -M intel sum.o&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;At &lt;code&gt;-O2&lt;/code&gt; GCC may vectorise the loop with SSE instructions (&lt;code&gt;paddd&lt;/code&gt;, &lt;code&gt;movdqu&lt;/code&gt;). Comparing the three levels side by side is one of the best ways to learn what compilers do.&lt;/p&gt;</description>
  </item>
  <item>
    <title>The ELF header, byte by byte</title>
    <link>https://ozdc.us/p/the-elf-header-byte-by-byte/</link>
    <guid isPermaLink="true">https://ozdc.us/p/the-elf-header-byte-by-byte/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Wed, 14 Oct 2026 00:00:00 +0000</pubDate>
    <category>elf</category>
    <category>linux</category>
    <category>tutorial</category>
    <description>&lt;p&gt;Every Linux executable, shared library and object file starts with an &lt;strong&gt;ELF header&lt;/strong&gt;. On 64-bit systems it&amp;#039;s exactly 64 bytes. It says what kind of file this is, which CPU it is for, where execution starts, and where the rest of the file&amp;#039;s tables are. Let&amp;#039;s decode a real one: &lt;code&gt;/bin/ls&lt;/code&gt; from Ubuntu 24.04.&lt;/p&gt;
&lt;h2 id=&quot;the-bytes&quot;&gt;The bytes&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;xxd -l 64 /bin/ls&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;hexdump&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;00000000&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;7f&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;45&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;4c&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;46&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;01&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;01&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|.ELF............|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000010&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;03&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;3e&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;01&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;30&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;6d&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|..&amp;gt;.....0m......|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000020&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;28&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;24&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|@.......($......|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000030&lt;/span&gt;  &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;38&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;0d&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;1f&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;1e&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|....@.8...@.....|&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything after the first 16 bytes is little-endian. If that&amp;#039;s new, read the hexdump post first.&lt;/p&gt;
&lt;h2 id=&quot;bytes-0x00-to-0x0f-e-ident&quot;&gt;Bytes 0x00 to 0x0f: e_ident&lt;/h2&gt;
&lt;p&gt;The first 16 bytes identify the file and say how to read the rest.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;7f 45 4c 46&lt;/code&gt;: the magic number, &lt;code&gt;0x7f&lt;/code&gt; followed by &lt;code&gt;ELF&lt;/code&gt;. The &lt;code&gt;file&lt;/code&gt; command checks exactly this.&lt;/li&gt;&lt;li&gt;&lt;code&gt;02&lt;/code&gt;: class. &lt;code&gt;1&lt;/code&gt; = 32-bit, &lt;code&gt;2&lt;/code&gt; = 64-bit.&lt;/li&gt;&lt;li&gt;&lt;code&gt;01&lt;/code&gt;: data encoding. &lt;code&gt;1&lt;/code&gt; = little-endian, &lt;code&gt;2&lt;/code&gt; = big-endian.&lt;/li&gt;&lt;li&gt;&lt;code&gt;01&lt;/code&gt;: ELF version, always 1.&lt;/li&gt;&lt;li&gt;&lt;code&gt;00&lt;/code&gt;: OS/ABI, &lt;code&gt;0&lt;/code&gt; = System V (the usual value on Linux).&lt;/li&gt;&lt;li&gt;The rest are the ABI version and padding.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;bytes-0x10-to-0x3f-the-fields&quot;&gt;Bytes 0x10 to 0x3f: the fields&lt;/h2&gt;
&lt;p&gt;Each field below is read little-endian.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;0x10&lt;/code&gt; &lt;strong&gt;e_type&lt;/strong&gt;, 2 bytes: &lt;code&gt;03 00&lt;/code&gt; = 3 = &lt;code&gt;ET_DYN&lt;/code&gt;. That&amp;#039;s a shared object, which is also what a position-independent executable (PIE) is. A non-PIE executable would be 2 (&lt;code&gt;ET_EXEC&lt;/code&gt;), and an object file &lt;code&gt;.o&lt;/code&gt; is 1 (&lt;code&gt;ET_REL&lt;/code&gt;).&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x12&lt;/code&gt; &lt;strong&gt;e_machine&lt;/strong&gt;, 2 bytes: &lt;code&gt;3e 00&lt;/code&gt; = &lt;code&gt;0x3e&lt;/code&gt; = 62 = x86-64. You&amp;#039;d see &lt;code&gt;0xb7&lt;/code&gt; for AArch64 and &lt;code&gt;0x03&lt;/code&gt; for 32-bit x86.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x14&lt;/code&gt; &lt;strong&gt;e_version&lt;/strong&gt;, 4 bytes: &lt;code&gt;01 00 00 00&lt;/code&gt; = 1.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x18&lt;/code&gt; &lt;strong&gt;e_entry&lt;/strong&gt;, 8 bytes: &lt;code&gt;30 6d 00 …&lt;/code&gt; = &lt;code&gt;0x6d30&lt;/code&gt;. The address where execution starts. In a PIE it&amp;#039;s relative, because the loader picks the real base address at run time.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x20&lt;/code&gt; &lt;strong&gt;e_phoff&lt;/strong&gt;, 8 bytes: &lt;code&gt;0x40&lt;/code&gt; = 64. The program headers start right after this header.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x28&lt;/code&gt; &lt;strong&gt;e_shoff&lt;/strong&gt;, 8 bytes: &lt;code&gt;28 24 02 00 …&lt;/code&gt; = &lt;code&gt;0x22428&lt;/code&gt; = 140328. The section headers are near the end of the file.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x30&lt;/code&gt; &lt;strong&gt;e_flags&lt;/strong&gt;, 4 bytes: 0, unused on x86-64.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x34&lt;/code&gt; &lt;strong&gt;e_ehsize&lt;/strong&gt;: &lt;code&gt;40 00&lt;/code&gt; = 64, the size of this header.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x36&lt;/code&gt; &lt;strong&gt;e_phentsize&lt;/strong&gt;: &lt;code&gt;38 00&lt;/code&gt; = 56 bytes per program header, and &lt;code&gt;0x38&lt;/code&gt; &lt;strong&gt;e_phnum&lt;/strong&gt;: &lt;code&gt;0d 00&lt;/code&gt; = 13 of them.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x3a&lt;/code&gt; &lt;strong&gt;e_shentsize&lt;/strong&gt;: &lt;code&gt;40 00&lt;/code&gt; = 64 bytes per section header, and &lt;code&gt;0x3c&lt;/code&gt; &lt;strong&gt;e_shnum&lt;/strong&gt;: &lt;code&gt;1f 00&lt;/code&gt; = 31 of them.&lt;/li&gt;&lt;li&gt;&lt;code&gt;0x3e&lt;/code&gt; &lt;strong&gt;e_shstrndx&lt;/strong&gt;: &lt;code&gt;1e 00&lt;/code&gt; = 30. The section that holds the section names.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;check-it&quot;&gt;Check it&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;readelf -h /bin/ls&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;readelf&lt;/code&gt; agrees with every value: Type &lt;code&gt;DYN&lt;/code&gt;, Machine &lt;code&gt;X86-64&lt;/code&gt;, Entry point &lt;code&gt;0x6d30&lt;/code&gt;, program headers at 64 with 13 entries of 56 bytes, section headers at 140328 with 31 entries of 64 bytes, string table index 30.&lt;/p&gt;
&lt;h2 id=&quot;program-headers-vs-section-headers&quot;&gt;Program headers vs. section headers&lt;/h2&gt;
&lt;p&gt;The header points to two tables, and it&amp;#039;s worth knowing why there are two:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Program headers&lt;/strong&gt; (segments) are what the &lt;strong&gt;loader&lt;/strong&gt; uses. They say which byte ranges of the file to map into memory, at what address, and with which permissions (read, write, execute).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Section headers&lt;/strong&gt; (&lt;code&gt;.text&lt;/code&gt;, &lt;code&gt;.rodata&lt;/code&gt;, &lt;code&gt;.data&lt;/code&gt;, &lt;code&gt;.bss&lt;/code&gt;, …) are for &lt;strong&gt;linkers and tools&lt;/strong&gt;. A program runs fine without them; &lt;code&gt;strip&lt;/code&gt; removes symbols, and some packers damage section headers on purpose to confuse analysis tools.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;That second point is the practical lesson: when a tool chokes on a binary, check the header and the program headers by hand. They are what the kernel actually trusts.&lt;/p&gt;
&lt;h2 id=&quot;try-it&quot;&gt;Try it&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;readelf -l /bin/ls&lt;/code&gt;: list the segments and their permissions&lt;/li&gt;&lt;li&gt;&lt;code&gt;readelf -S /bin/ls&lt;/code&gt;: list the sections&lt;/li&gt;&lt;li&gt;&lt;code&gt;xxd -s 0x40 -l 56 /bin/ls&lt;/code&gt;: the first program header, raw&lt;/li&gt;&lt;/ul&gt;</description>
  </item>
  <item>
    <title>Reading a hexdump</title>
    <link>https://ozdc.us/p/reading-a-hexdump/</link>
    <guid isPermaLink="true">https://ozdc.us/p/reading-a-hexdump/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Tue, 13 Oct 2026 00:00:00 +0000</pubDate>
    <category>basics</category>
    <category>hex</category>
    <category>tutorial</category>
    <description>&lt;p&gt;Every file is just a row of bytes. A hexdump prints them in a form a human can scan. Once you can read one fluently, file formats, network captures and memory dumps stop being opaque. This post walks through one 16-byte example line by line.&lt;/p&gt;
&lt;p&gt;Tip: every page on this site has a &lt;strong&gt;Hex View&lt;/strong&gt; tab (press &lt;code&gt;x&lt;/code&gt;) and a &lt;strong&gt;Strings&lt;/strong&gt; tab (press &lt;code&gt;s&lt;/code&gt;). Try them on this post as you read.&lt;/p&gt;
&lt;h2 id=&quot;one-line-of-a-hexdump&quot;&gt;One line of a hexdump&lt;/h2&gt;
&lt;p&gt;This is a 16-byte file, printed with &lt;code&gt;hexdump -C sample.bin&lt;/code&gt; (on Linux, &lt;code&gt;xxd sample.bin&lt;/code&gt; or &lt;code&gt;od -A x -t x1z sample.bin&lt;/code&gt; show the same thing):&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;hexdump&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;00000000&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;48&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;69&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;21&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;0a&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;01&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;ff&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;34&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;12&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;ef&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;be&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;ad&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;de&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|Hi!.....4.......|&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It has three columns:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Offset&lt;/strong&gt; (&lt;code&gt;00000000&lt;/code&gt;): where in the file this line starts, in hex. The next line would start at &lt;code&gt;00000010&lt;/code&gt;, which is 16.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Bytes&lt;/strong&gt;: sixteen bytes, each as two hex digits. One hex digit is 4 bits, so two digits are exactly one byte (0 to 255, written &lt;code&gt;00&lt;/code&gt; to &lt;code&gt;ff&lt;/code&gt;). The extra gap after the eighth byte is only there to help your eyes.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;ASCII&lt;/strong&gt;: the same bytes shown as text. Printable characters appear as themselves, everything else as a dot.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;text-is-just-numbers&quot;&gt;Text is just numbers&lt;/h2&gt;
&lt;p&gt;The first three bytes are &lt;code&gt;48 69 21&lt;/code&gt;. In ASCII, &lt;code&gt;0x48&lt;/code&gt; is &lt;code&gt;H&lt;/code&gt;, &lt;code&gt;0x69&lt;/code&gt; is &lt;code&gt;i&lt;/code&gt;, and &lt;code&gt;0x21&lt;/code&gt; is &lt;code&gt;!&lt;/code&gt;. That&amp;#039;s why the ASCII column starts with &lt;code&gt;Hi!&lt;/code&gt;. The fourth byte, &lt;code&gt;0a&lt;/code&gt;, is a newline. It isn&amp;#039;t printable, so it shows as a dot.&lt;/p&gt;
&lt;p&gt;A few values are worth memorising, because you&amp;#039;ll see them everywhere:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;20&lt;/code&gt; space, &lt;code&gt;0a&lt;/code&gt; newline, &lt;code&gt;0d&lt;/code&gt; carriage return (Windows line endings are &lt;code&gt;0d 0a&lt;/code&gt;)&lt;/li&gt;&lt;li&gt;&lt;code&gt;30&lt;/code&gt; to &lt;code&gt;39&lt;/code&gt; are the digits &lt;code&gt;0&lt;/code&gt; to &lt;code&gt;9&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;41&lt;/code&gt; to &lt;code&gt;5a&lt;/code&gt; are &lt;code&gt;A&lt;/code&gt; to &lt;code&gt;Z&lt;/code&gt;, and &lt;code&gt;61&lt;/code&gt; to &lt;code&gt;7a&lt;/code&gt; are &lt;code&gt;a&lt;/code&gt; to &lt;code&gt;z&lt;/code&gt;; lower case is upper case plus &lt;code&gt;0x20&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;00&lt;/code&gt; is the NUL byte: C strings end with it, and long runs of it are usually padding&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;numbers-wider-than-one-byte&quot;&gt;Numbers wider than one byte&lt;/h2&gt;
&lt;p&gt;Look at bytes 8 to 11: &lt;code&gt;34 12 00 00&lt;/code&gt;. If a program stored a 32-bit integer there, what is its value?&lt;/p&gt;
&lt;p&gt;On x86 and most ARM systems, multi-byte numbers are stored &lt;strong&gt;little-endian&lt;/strong&gt;: the least significant byte comes first. To read the number, reverse the bytes: &lt;code&gt;00 00 12 34&lt;/code&gt;, which is &lt;code&gt;0x1234&lt;/code&gt; = 4660.&lt;/p&gt;
&lt;p&gt;The last four bytes, &lt;code&gt;ef be ad de&lt;/code&gt;, work the same way. Reversed, they read &lt;code&gt;de ad be ef&lt;/code&gt;: &lt;code&gt;0xDEADBEEF&lt;/code&gt;, a classic marker value that programmers use precisely because it&amp;#039;s easy to spot in a dump.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Big-endian is the other order: most significant byte first, the way we write numbers. Network protocols use it (&amp;quot;network byte order&amp;quot;), so the same value can appear in both orders within one capture.&lt;/p&gt;&lt;/blockquote&gt;
&lt;h2 id=&quot;exercise&quot;&gt;Exercise&lt;/h2&gt;
&lt;p&gt;Go back to the line above and answer, without a calculator:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Which byte is the NUL that ends the first &amp;quot;string&amp;quot;?&lt;/li&gt;&lt;li&gt;If bytes 4 and 5 (&lt;code&gt;01 02&lt;/code&gt;) were a 16-bit little-endian number, what would it be?&lt;/li&gt;&lt;li&gt;Why does &lt;code&gt;ff&lt;/code&gt; show as a dot?&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Answers: the &lt;code&gt;00&lt;/code&gt; at offset 7; &lt;code&gt;0x0201&lt;/code&gt; = 513; and &lt;code&gt;0xff&lt;/code&gt; is above &lt;code&gt;0x7e&lt;/code&gt;, outside printable ASCII.&lt;/p&gt;
&lt;h2 id=&quot;tools&quot;&gt;Tools&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;xxd file&lt;/code&gt; or &lt;code&gt;hexdump -C file&lt;/code&gt;: dump a file&lt;/li&gt;&lt;li&gt;&lt;code&gt;xxd -l 64 file&lt;/code&gt;: only the first 64 bytes&lt;/li&gt;&lt;li&gt;&lt;code&gt;xxd -s 0x100 -l 32 file&lt;/code&gt;: 32 bytes starting at offset &lt;code&gt;0x100&lt;/code&gt;&lt;/li&gt;&lt;li&gt;&lt;code&gt;xxd -r&lt;/code&gt;: turn an edited dump back into a binary, a cheap way to patch a byte&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Next: the ELF header, byte by byte, where this skill pays off immediately.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Evolution, illustrated</title>
    <link>https://ozdc.us/p/evolution-illustrated/</link>
    <guid isPermaLink="true">https://ozdc.us/p/evolution-illustrated/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Tue, 28 Jul 2026 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>biology</category>
    <category>evolution</category>
    <category>essay</category>
    <description>&lt;p&gt;How does a process with no designer, plan or goal produce eyes, wings and brains? The answer is an algorithm short enough to state in one line: copy with small errors, test the copies against the world, keep what works, repeat for a very long time. Biology gives us both the source code (genomes) and a partial version history (fossils), and the two agree. Darwin&amp;#039;s revolution appears in &lt;em&gt;The revolutions of our time&lt;/em&gt;. This post is the illustrated tour.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+--------------------+   +--------------------+   +--------------------+
|     VARIATION      |   |    INHERITANCE     |   |     SELECTION      |
|  offspring differ  |   |traits are passed on|   |some variants leave |
| (mutation, mixing  |--&amp;gt;|   (genes, copied   |--&amp;gt;|  more descendants  |
| of parental genes) |   | with small errors) |   |in this environment |
+---------+----------+   +--------------------+   +---------+----------+
          ^                                                 |
          |                                                 |
          +-------------------------------------------------+
               TIME: repeat for thousands to billions of generations&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;four-ingredients&quot;&gt;Four ingredients&lt;/h2&gt;
&lt;p&gt;If a population has &lt;strong&gt;variation&lt;/strong&gt;, if that variation is &lt;strong&gt;inherited&lt;/strong&gt;, and if some variants leave more descendants than others (&lt;strong&gt;selection&lt;/strong&gt;), then given enough &lt;strong&gt;time&lt;/strong&gt; the population changes. Nothing else is needed: no foresight, no goal. Richard Lewontin spelled out these conditions in 1970. Darwin knew nothing of genes, and the logic worked without them.&lt;/p&gt;
&lt;p&gt;Selection is not magic. It acts only on variation that already exists, and only in the environment where it happens. Even a modest edge compounds quickly:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  generation   share of the population  (# dark morph, . pale morph)

       0       |####....................................| 10.0%
       5       |############............................| 29.2%
      10       |########################................| 60.5%
      15       |##################################......| 85.0%
      20       |######################################..| 95.5%
      30       |########################################| 99.7%

  assumed: dark moths leave 1.3 times as many offspring as pale
  ones. Illustrative numbers: one gene, no mutation, no drift.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice the shape: a slow start while the variant is rare, a fast middle, a slow finish. Real populations are messier. Environments change, so yesterday&amp;#039;s winner can become tomorrow&amp;#039;s loser, and most traits carry trade-offs.&lt;/p&gt;
&lt;h2 id=&quot;darwin-wallace-and-the-long-wait&quot;&gt;Darwin, Wallace and the long wait&lt;/h2&gt;
&lt;p&gt;Charles Darwin sailed on HMS &lt;em&gt;Beagle&lt;/em&gt; (1831-36), had the core idea by 1838 after reading Malthus on population, and then held it back for twenty years while he gathered evidence. In June 1858 an essay arrived from Alfred Russel Wallace, who was collecting specimens in the Malay Archipelago and had reached the same mechanism independently. Friends arranged a joint presentation at the Linnean Society on 1 July 1858, and &lt;em&gt;On the Origin of Species&lt;/em&gt; followed on 24 November 1859. The phrase &amp;quot;survival of the fittest&amp;quot; came from the philosopher Herbert Spencer (1864), and Darwin adopted it in later editions.&lt;/p&gt;
&lt;p&gt;The missing piece was inheritance. Mendel&amp;#039;s pea experiments (1866) went unnoticed until 1900. The &lt;strong&gt;modern synthesis&lt;/strong&gt; of the 1930s and 1940s (Fisher, Haldane, Wright, Dobzhansky, Mayr) joined Darwin to genetics, and Watson and Crick (1953) supplied the molecule. An influential story, associated with Ernst Mayr, says Darwin replaced fixed &amp;quot;essences&amp;quot;, the kind discussed in &lt;em&gt;What is existence? A short tour of ontology&lt;/em&gt;, with &amp;quot;population thinking&amp;quot;. Some historians think that story oversimplifies, but the shift of attention from the ideal type to the varying population is real.&lt;/p&gt;
&lt;h2 id=&quot;more-than-selection&quot;&gt;More than selection&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Mutation&lt;/strong&gt; creates new variants. A human child carries on the order of seventy new mutations that neither parent had.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Genetic drift&lt;/strong&gt; is change by chance, strongest in small populations. In Motoo Kimura&amp;#039;s neutral theory (1968), most molecular differences between species are neutral and spread by drift.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Gene flow&lt;/strong&gt; moves genes between populations. It can spread a useful variant or blur differences.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Sexual selection&lt;/strong&gt;, which Darwin developed in 1871, favours traits that win mates, even costly ones like a peacock&amp;#039;s tail.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Biologists still argue about how much weight each force deserves, and whether development and non-genetic inheritance need a larger role in theory. Those are debates about how evolution works, not whether it happened.&lt;/p&gt;
&lt;h2 id=&quot;the-evidence&quot;&gt;The evidence&lt;/h2&gt;
&lt;p&gt;Several independent lines point the same way.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Fossils that fit predictions.&lt;/strong&gt; Searching 375-million-year-old rocks on Ellesmere Island in Arctic Canada, where fish-to-land-animal transition sediments were expected, Neil Shubin&amp;#039;s team found &lt;em&gt;Tiktaalik&lt;/em&gt; in 2004. Fossil series also trace whales back to four-legged land mammals, and DNA places their closest living relatives among hippos.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Shared code and dead code.&lt;/strong&gt; A bat wing, a whale flipper and a human arm contain the same bones. In genomes, humans, other apes and monkeys carry a broken copy of &lt;em&gt;GULO&lt;/em&gt;, a gene that makes vitamin C in most other mammals. Human chromosome 2 is a fusion of two chromosomes that stay separate in other apes, with telomere remnants in the middle. A reverse engineer knows the logic: two programs with the same odd bug share ancestry. Life is full of shared bugs.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Molecular clocks.&lt;/strong&gt; DNA differences accumulate roughly steadily (Zuckerkandl and Pauling, 1960s). Calibrated against fossils, they date splits, such as human and chimp lineages at about 6-7 million years ago. Rates vary with generation time, so the dates are ranges.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Evolution you can watch.&lt;/strong&gt; Penicillin-resistant bacteria appeared within a few years of its mass use in the 1940s, and Fleming warned of it in 1945. A 2019 estimate attributes over a million deaths a year directly to resistant bacterial infections. Richard Lenski&amp;#039;s &lt;em&gt;E. coli&lt;/em&gt; lines have evolved since 1988 through more than 75,000 generations, and one lineage learned to use citrate around generation 31,000. On the Galapagos island of Daphne Major, Peter and Rosemary Grant saw finch beaks deepen after the 1977 drought.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Our own past.&lt;/strong&gt; Ancient DNA shows that modern humans and Neanderthals interbred. People whose ancestors lived outside Africa carry roughly one to two percent Neanderthal DNA, a result by Svante Pääbo&amp;#039;s group that earned the 2022 Nobel Prize.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Peppered moths&lt;/strong&gt; deserve a caveat. The dark form was rare before 1848, then dominated near industrial cities, then declined after clean-air laws. Bernard Kettlewell&amp;#039;s 1950s experiments were criticised for design flaws, such as moths placed on tree trunks by day, and textbooks later told the story too neatly. But a six-year repeat by Michael Majerus, published in 2012, still supports bird predation as the main driver, and in 2016 the dark form was traced to a mobile genetic element inserted in a single gene.&lt;/p&gt;
&lt;h2 id=&quot;deep-time&quot;&gt;Deep time&lt;/h2&gt;
&lt;p&gt;The fourth ingredient is the hardest to feel. Squeeze the age of the Earth into one day and the picture below appears. Dates are approximate and revised often, but their order is robust.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;     clock*     years ago          event
  /|                                                            |\
  || 23:59:59.9 5,000 years ago    writing                      ||
  ||============================================================||
  || 23:59:54   300,000 years ago  Homo sapiens                 ||
  ||============================================================||
  || 23:57:56   6.5 million        human and chimp lines split  ||
  ||============================================================||
  || 23:39      66 million         non-bird dinosaurs end       ||
  ||============================================================||
  || 22:01      375 million        Tiktaalik, a fish with limbs ||
  ||============================================================||
  || 20:50      600 million        first animals                ||
  ||============================================================||
  || 14:29      1.8 billion        complex (eukaryotic) cells   ||
  ||============================================================||
  || 11:19      2.4 billion        oxygen builds up in the air  ||
  ||============================================================||
  || 05:30      3.5 billion        oldest accepted fossils      ||
  ||============================================================||
  || 00:00      4.54 billion       Earth forms                  ||
  ||                                                            ||

  * Earth&amp;#039;s 4.54 billion years squeezed into one day; top = now&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-tree-of-life&quot;&gt;The tree of life&lt;/h2&gt;
&lt;p&gt;In 1837 Darwin sketched a branching tree in a notebook and wrote &amp;quot;I think&amp;quot; above it. The &lt;em&gt;Origin&lt;/em&gt;&amp;#039;s only illustration is a branching diagram. Carl Woese&amp;#039;s ribosomal RNA work (1977) showed that Archaea are a third major group beside Bacteria and Eukarya. Many recent analyses nest the eukaryotes inside the Archaea, which would make two domains. Microbes also swap genes sideways, so the deepest roots look more like a web than a tree. Mitochondria descend from engulfed bacteria (Lynn Margulis, 1967). At the root of the sample below sits &lt;strong&gt;LUCA&lt;/strong&gt;, the last universal common ancestor, a population that lived somewhere around 3.5 to 4 billion years ago; estimates vary.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;older   (branching order only)             tips: all alive today
LUCA -+------------------------------------- Bacteria
      +--+---------------------------------- Archaea
         +--+------------------------------- Plants and algae
            +--+---------------------------- Fungi
               +--+------------------------- Insects, snails, worms
                  +--+---------------------- Ray-finned fish
                     +--+------------------- Amphibians
                        +--+---------------- Reptiles and birds
                           +--+------------- Dogs, whales, bats
                              +--+---------- Old World monkeys
                                 +-+-------- Orangutan
                                   +-+------ Gorilla
                                     +-+---- Chimps and bonobos
                                       +---- Humans&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Some surprises sit in the branching order. Fungi are closer kin to animals than plants are. Birds are dinosaurs. Whales are even-toed ungulates, with hippos as their nearest living relatives. The drawing follows our own lineage as a spine, which tempts you to read it as a ladder toward us. All tips are alive today, and none is further along than the others. Redraw it with a mushroom as the spine and it looks just as sensible.&lt;/p&gt;
&lt;h2 id=&quot;misconceptions&quot;&gt;Misconceptions&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+--------------------------+-------------------------------------------+
| MYTH                     | WHAT THE EVIDENCE SAYS                    |
+--------------------------+-------------------------------------------+
| Survival of the          | Fitness means leaving more surviving      |
| strongest                | offspring in a given environment. Winners |
|                          | can be small, shy, cooperative, or lucky. |
+--------------------------+-------------------------------------------+
| We descended from chimps | Humans and chimps share an ancestor from  |
|                          | some 6-7 million years ago. Neither is    |
|                          | the ancestor of the other.                |
+--------------------------+-------------------------------------------+
| Evolution climbs a       | It is a branching bush with no goal. By   |
| ladder to humans         | count, microbes still dominate life.      |
+--------------------------+-------------------------------------------+
| It is just a theory      | In science a theory is a broad, tested    |
|                          | explanation, like germ theory or the      |
|                          | theory of gravity.                        |
+--------------------------+-------------------------------------------+
| Individuals evolve       | An individual develops; a population      |
|                          | evolves over generations as gene          |
|                          | frequencies shift.                        |
+--------------------------+-------------------------------------------+
| It is all random chance  | Mutation is random with respect to need.  |
|                          | Selection is not random. Together they    |
|                          | are not blind luck.                       |
+--------------------------+-------------------------------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Two limits are worth stating. Evolution explains how life diversified, not how it began; that is a separate research question. And it is a theory about biology, not a guide to values. Many scientists who are religious accept evolution, and how it bears on questions of meaning is a conversation biology does not settle.&lt;/p&gt;
&lt;h2 id=&quot;closing&quot;&gt;Closing&lt;/h2&gt;
&lt;p&gt;Reading a genome is reverse engineering with a version history attached. The result has no author, yet it shows the marks of legacy code. A giraffe&amp;#039;s laryngeal nerve runs down the neck, around a blood vessel and back up, a detour of several metres where centimetres would do, because evolution edits what exists and cannot restart from scratch.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Nature as engineer: what nature teaches us</title>
    <link>https://ozdc.us/p/nature-as-engineer/</link>
    <guid isPermaLink="true">https://ozdc.us/p/nature-as-engineer/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Tue, 16 Jun 2026 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>engineering</category>
    <category>biology</category>
    <category>biomimicry</category>
    <category>essay</category>
    <description>&lt;p&gt;Evolution has run a research and development programme for about 3.5 billion years. On the calendar in &lt;em&gt;The universe in one year: a cosmic calendar&lt;/em&gt; that is about three months, most of it spent on microbes, and it started from the poorly understood beginning described in &lt;em&gt;Life&amp;#039;s origin: what we know and what we don&amp;#039;t&lt;/em&gt;. The designs that survived are good enough to be worth studying. &lt;strong&gt;Biomimicry&lt;/strong&gt; (a word popularised by Janine Benyus in her 1997 book) means learning a &lt;em&gt;principle&lt;/em&gt; from a living thing and using it in engineering.&lt;/p&gt;
&lt;p&gt;The stress is on principle. Almost every successful case copies a mechanism, not a shape, and nature is not an optimiser. Evolution, the idea at the heart of &lt;em&gt;Five ideas that built modern science&lt;/em&gt;, produces what is good enough with the materials and the history at hand, and engineers have steel, concrete and electricity as well. Here are eight cases, with the hype checked.&lt;/p&gt;
&lt;h2 id=&quot;1-burdock-and-velcro-1941-1955&quot;&gt;1. Burdock and Velcro (1941, 1955)&lt;/h2&gt;
&lt;p&gt;In 1941 the Swiss engineer &lt;strong&gt;George de Mestral&lt;/strong&gt; came back from a hunting trip in the Swiss mountains with burrs of burdock stuck to his clothes and his dog&amp;#039;s fur. Under a microscope he saw tiny hooks catching loops. Turning that into a product took years: cotton versions frayed, so he switched to nylon, worked with a weaver in Lyon and found that infrared light could set the hooks. The Swiss patent was filed in 1951 and granted in 1955. The name joins &lt;em&gt;velours&lt;/em&gt; (velvet) and &lt;em&gt;crochet&lt;/em&gt; (hook).&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;BEFORE                              PRESSED TOGETHER
=== loop tape ========
 ()  ()  ()  ()  ()                 ======================
                                     (J) (J) (J) (J) (J)
 J   J   J   J   J                  ======================
=== hook tape ========              each loop is caught by a hook

SHEAR (pull sideways): every hook holds its loop, so it is very strong.
PEEL (lift one edge): hooks let go one row at a time, which is easy.
That is the &amp;quot;rrrip&amp;quot; you hear.

Burdock burr (nature): hooked bracts catch the loops in cloth or fur.
Velcro (1941 idea, 1955 patent): nylon hooks and nylon loops.&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;2-the-lotus-leaf-surfaces-that-clean-themselves&quot;&gt;2. The lotus leaf: surfaces that clean themselves&lt;/h2&gt;
&lt;p&gt;Lotus leaves stay clean in muddy water. &lt;strong&gt;Wilhelm Barthlott&lt;/strong&gt; and &lt;strong&gt;Christoph Neinhuis&lt;/strong&gt; studied why with the electron microscope and published their 1997 paper on the sacred lotus&amp;#039;s &amp;quot;escape from contamination&amp;quot;. The leaf has a double structure: bumps (papillae) 10 to 20 micrometres high, covered in wax crystals. Water cannot enter the gaps, so the drop rests on air and on a few percent of the surface.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;SMOOTH WAX LEAF                       LOTUS LEAF
contact angle about 105 degrees       contact angle about 160 degrees

        .-&amp;quot;&amp;quot;&amp;quot;&amp;quot;-.                                .-&amp;quot;&amp;quot;&amp;quot;&amp;quot;-.
     .&amp;#039;        &amp;#039;.                            .&amp;#039;        &amp;#039;.
    /            \                          /            \
   |              |                        |              |
   |              |                         \            /
    \            /                           `-.        .-&amp;#039;
     `-.______.-&amp;#039;                                `-.__.-&amp;#039;
----------------------------          /\/\/\/\/\/\/\/\/\/\/\/\/\/\
flat wax: the drop sags and           papillae 10-20 um high, covered
spreads, wide contact area            in wax: air stays trapped between
                                      the tips, under the drop

Cassie-Baxter: cos(angle) = f x (cos(wax angle) + 1) - 1
   f = share of the drop that touches solid = 5%, wax angle = 105 deg
   cos(angle) = 0.05 x (-0.259 + 1) - 1 = -0.963 -&amp;gt; angle = 164 deg

SELF-CLEANING   (tilt the leaf a few degrees; o = dirt grain)
     .-&amp;quot;-.
    ( oo )--&amp;gt;       o     o  o   o
     `-._.-&amp;#039;
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
grains stick to the drop more than to the leaf, so they leave with it&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The calculation shows why texture matters: a wax surface alone gives about 105 degrees, but touching only 5% of the solid pushes the angle to about 164. Paints and coatings based on it appeared around 1999. The limits are real. The effect works for water, not oils or solvents, and the delicate texture wears off.&lt;/p&gt;
&lt;h2 id=&quot;3-gecko-feet-glue-free-grip&quot;&gt;3. Gecko feet: glue-free grip&lt;/h2&gt;
&lt;p&gt;A gecko climbs glass without glue, suction or sticky liquid. &lt;strong&gt;Kellar Autumn&amp;#039;s&lt;/strong&gt; group showed in 2000 that one hair (a &lt;em&gt;seta&lt;/em&gt;) pulls with about 200 micronewtons, and in 2002 that the force is the weak van der Waals attraction between molecules, because geckos grip water-loving and water-hating surfaces equally well.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;1. TOE PAD (about 1 cm wide)
   =========  =========  =========  =========  =========rows of ridges
                                                        (lamellae)
                              |
                              v  zoom x100

2. SETAE (hairs ~100 um long, ~5 um thick, ~14,000 per mm^2)
   \   \   \   \   \   \   \   \   \   \   \   \   \  angled hairs:
    \   \   \   \   \   \   \   \   \   \   \   \   \ grip when pulled,
                                                      let go when peeled
                              |
                              v  zoom x50

3. ONE SETA branches at its tip
                       \ | /            about 200 uN of pull
                        \|/             from one hair
                         |              (Autumn et al., 2000)
                  ,-.   ,-.   ,-.   ,-.
                              |
                              v  zoom x100

4. SPATULAE: ~1000 flat tips per seta, each ~200 nm wide
     _____  _____  _____  _____  _____  _____  _____
     =============================================  wall

Between tip and wall (gap under 1 nm) molecules attract each other
weakly (van der Waals force). Billions of tips add up to a strong grip.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Check the arithmetic: about 6.5 million setae times 194 micronewtons is 1,260 newtons, enough to hold roughly 130 kg if every hair gripped at once. No gecko uses them all, and the hairs release by changing their angle, which is why the animal can peel a foot off in a few hundredths of a second. In 2003 &lt;strong&gt;Andre Geim&amp;#039;s&lt;/strong&gt; group at Manchester made an early &amp;quot;gecko tape&amp;quot; from polymer hairs. Synthetic versions now exist as grippers and climbing-robot feet, but they collect dust and wear out far sooner than a real foot, which cleans itself as it walks.&lt;/p&gt;
&lt;h2 id=&quot;4-the-kingfisher-and-the-500-series&quot;&gt;4. The kingfisher and the 500 series&lt;/h2&gt;
&lt;p&gt;Early bullet trains had a problem. A train entering a tunnel at speed pushes the air ahead like a piston, and that compression leaves the far mouth as a loud boom. Making trains faster made the boom worse. &lt;strong&gt;Eiji Nakatsu&lt;/strong&gt;, an engineer at JR West and a bird-watcher, noticed that a kingfisher dives from thin air into dense water with hardly a splash, thanks to its long tapered beak. The 500 series (service from March 1997, 300 km/h) has a nose about 15 m long.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;A. BLUNT NOSE (bullet shape)
the cross-section grows fast

       ###############################      air is pushed aside at once:
    ##################################      a steep pressure step forms;
   ###################################      in a tunnel: a boom
  ####################################
   ###################################
    ##################################
       ###############################

B. LONG TAPERED NOSE (500 series)
a nose about 15 m long

                                ######      air parts gradually: the
                     #################      pressure rises gently, so
           ###########################      the tunnel boom is weaker
  ####################################
           ###########################
                     #################
                                ######

C. KINGFISHER HEAD AND BEAK
a dagger beak, then the wider head

                                    ##      diving from thin air into
                            ##########      dense water with little
                    ############o#####      splash needs the same ramp
  ####################################
                    ##################
                            ##########
                                    ##&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The physics is sound: the more gradually the cross-section grows, the more gently the air pressure rises. Reported results are about 10% higher speed and 15% lower energy use compared with the older design, but sources differ on details. Wind-tunnel tests and computer simulation shaped the final nose, with the bird as inspiration, and the same team reportedly gave the pantograph owl-like serrations to cut noise.&lt;/p&gt;
&lt;h2 id=&quot;5-termites-and-the-eastgate-centre-a-cautionary-case&quot;&gt;5. Termites and the Eastgate Centre (a cautionary case)&lt;/h2&gt;
&lt;p&gt;The Eastgate Centre in Harare, Zimbabwe (1996, architect Mick Pearce with the engineers at Arup) is often said to copy a termite mound. It has no conventional air conditioning. Concrete slabs and ducts are chilled by night air, daytime air passes over the cold mass, and warm air rises through an atrium and chimneys. Reported energy use is around a third of comparable buildings, and some sources claim far less.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                           ^    ^    ^    ^    ^
                       warm air leaves by the chimneys
                           | |  | |  | |  | |
                           | |  | |  | |  | |
  +----------------------+ | |  | |  | |  | | +----------------------+
  |                  -&amp;gt;         ATRIUM         &amp;lt;-                    |
  |  OFFICES             |                    |      OFFICES         |
  |                      |  air rises (stack  |                      |
  |======================|  effect) from the  |======================|
  |                      |  warm offices      |                      |
  |     ^     ^     ^    |                    |    ^     ^     ^     |
  |                      |                    |                      |
  |======================|                    |======================|
  |                      |                    |                      |
  |     ^     ^     ^    |                    |    ^     ^     ^     |
  |                      |                    |                      |
  |======================|                    |======================|
  | -&amp;gt;                   |                    |                 &amp;lt;-   |
  | fans                 |                    |                fans  |
  +------------------------------------------------------------------+
= concrete slabs and ducts: thermal mass
NIGHT: cool outside air is pushed through them and chills the concrete.
DAY: incoming air passes the cold concrete, warms up in the offices,
and rises out through the atrium and chimneys. No big cooling plant.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here the biology needs a caveat. Termite expert &lt;strong&gt;Scott Turner&lt;/strong&gt; describes the mounds of &lt;em&gt;Macrotermes&lt;/em&gt; as something closer to a lung than an air conditioner, and field studies by Mahadevan&amp;#039;s group found that airflow in mounds reverses twice a day, driven by daily temperature swings. Eastgate also uses heavy concrete and powered fans, which termites do not. So it is best called &lt;em&gt;termite-inspired&lt;/em&gt;: sound physics (night flushing), only loosely termite biology. The building works either way.&lt;/p&gt;
&lt;h2 id=&quot;6-shark-skin&quot;&gt;6. Shark skin&lt;/h2&gt;
&lt;p&gt;Shark skin is covered in tiny ridged scales. Grooves (&lt;em&gt;riblets&lt;/em&gt;) a few tens of micrometres wide and aligned with the flow stop the small swirls in the boundary layer from touching the surface at full strength, which cuts friction drag by up to about 5 to 10% in lab tests. NASA research led to riblet film that 3M made, tested on racing yachts and on an Airbus A320. Today a film called AeroSHARK flies on Lufthansa Group long-haul jets with a claimed saving of about 1% of fuel. That sounds modest, but friction is only about half of an airliner&amp;#039;s drag and the film covers part of the aircraft. The &amp;quot;shark-skin&amp;quot; swimsuits of 2000 are a warning: studies suggested their benefit came mostly from compression and slippery fabric, and the polyurethane suits that followed were banned in 2010.&lt;/p&gt;
&lt;h2 id=&quot;7-spider-silk&quot;&gt;7. Spider silk&lt;/h2&gt;
&lt;p&gt;Dragline silk is about 1.1 gigapascals strong at a density of 1.3 g/cm3. High-strength steel, say 1.5 GPa at 7.85 g/cm3, is stronger in absolute terms, but weight for weight silk is about four times better. Its toughness, the energy absorbed before breaking, is around 160 megajoules per cubic metre against roughly 50 for Kevlar and 6 for steel (measurements from the 1990s by Gosline and colleagues). A spider makes it at room temperature from a water-based protein solution, which then solidifies as it flows through a narrow duct. Spiders cannot be farmed, as they eat each other, so companies make silk-like proteins by fermentation with bacteria or yeast. Matching the natural fibre at industrial scale is still hard, especially the spinning step.&lt;/p&gt;
&lt;h2 id=&quot;8-ants-and-swarms&quot;&gt;8. Ants and swarms&lt;/h2&gt;
&lt;p&gt;Ants find short routes without a leader. In the double-bridge experiments of &lt;strong&gt;Goss and Deneubourg&lt;/strong&gt; (1989 and 1990) Argentine ants chose between a short and a long branch to food, and most ended up using the short one. The mechanism: each ant lays a chemical trail, the short path is completed sooner so its trail strengthens first, more ants follow, and the long trail evaporates.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;t = 0   no trail yet: ants pick a path at random
   .................................................................
   .                                                               .
   .                long path: more steps per trip                 .
+------+                                                        +------+
| NEST |........................................................| FOOD |
+------+                                                        +------+
                    short path: fewer steps per trip

t = 1   short-path ants return sooner, so its trail grows first
   .................................................................
   .                                                               .
   .                long path: more steps per trip                 .
+------+                                                        +------+
| NEST |========================================================| FOOD |
+------+                                                        +------+
                    short path: fewer steps per trip

t = 2   more ants follow the strong trail, which makes it stronger
   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
   .                                                               .
   .                long path: more steps per trip                 .
+------+                                                        +------+
| NEST |########################################################| FOOD |
+------+                                                        +------+
                    short path: fewer steps per trip

#  strong trail    =  medium    .  weak, evaporating
ACO rule: p(step) ~ trail^a x closeness^b ; each round:
trail &amp;lt;- (1 - r) x trail + Q / route length   (evaporate, then deposit)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Marco Dorigo&lt;/strong&gt; turned this into &lt;em&gt;ant colony optimisation&lt;/em&gt; in 1992, used since for vehicle routing, scheduling and network routing. On static travelling-salesman benchmarks specialised solvers do better, but ant methods suit problems where the map keeps changing. In robotics, Harvard&amp;#039;s 2014 Kilobot swarm of 1,024 tiny robots, each costing about 14 dollars in parts, formed shapes using only neighbour-to-neighbour rules, and termite-inspired robots built simple structures.&lt;/p&gt;
&lt;h2 id=&quot;what-to-take-away&quot;&gt;What to take away&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Copy the principle, not the shape.&lt;/strong&gt; Velcro uses nylon, Eastgate uses concrete. What carries over is hook-and-loop, night flushing, the slow ramp.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Check the story.&lt;/strong&gt; The kingfisher and the termites are widely told, but the numbers vary by source and the termite model is disputed. Lotus coatings and gecko tapes wear out.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Nature is a library, not an oracle.&lt;/strong&gt; Evolution satisfies; engineers can combine its tricks with materials and power sources it never had.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;And it goes both ways. Biologists now use engineering to ask whether a feature is really optimal, and engineers have borrowed evolution itself, in the form of the directed evolution of enzymes. The most useful lesson may be the plainest one: look closely at the thing in front of you, as a man with a hunting dog and a microscope once did.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Black holes, simply</title>
    <link>https://ozdc.us/p/black-holes-simply/</link>
    <guid isPermaLink="true">https://ozdc.us/p/black-holes-simply/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Tue, 26 May 2026 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>astronomy</category>
    <category>physics</category>
    <category>black-holes</category>
    <description>&lt;p&gt;A black hole is the ultimate black box: an interface through which things go in and nothing comes out. Anyone who spends time with programs whose insides they cannot see will find the idea familiar. Yet black holes are also among the simplest objects in physics. Once one has settled down, three numbers describe it completely: its mass, its spin and its electric charge. Classically, everything else about what fell in is forgotten. This post builds the idea from one school-level formula.&lt;/p&gt;
&lt;h2 id=&quot;start-with-a-thrown-ball&quot;&gt;Start with a thrown ball&lt;/h2&gt;
&lt;p&gt;Throw a ball upward and gravity brings it back. Throw it harder and it goes higher. There is a speed beyond which it never returns, the &lt;strong&gt;escape velocity&lt;/strong&gt;: v = sqrt(2GM/R), where M is the mass of the planet or star, R the distance from its centre and G the gravitational constant. For Earth&amp;#039;s surface it is 11.2 km/s, for the Moon 2.4 km/s, and for the Sun&amp;#039;s surface 618 km/s. Light travels at 299,792 km/s.&lt;/p&gt;
&lt;p&gt;In 1783 John Michell, and in 1796 Pierre-Simon Laplace, asked the obvious question: what if a star were so massive and compact that its escape velocity exceeded the speed of light? Light would never get out. Set v equal to c and solve for R:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;R = 2GM / c^2&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This is the &lt;strong&gt;Schwarzschild radius&lt;/strong&gt;. Karl Schwarzschild found the same number in 1916 as an exact solution of Einstein&amp;#039;s equations of general relativity, only weeks after they were published, while serving in the German army in the First World War. The Newtonian route gets the number right partly by luck; its real meaning comes from general relativity.&lt;/p&gt;
&lt;h2 id=&quot;worked-example&quot;&gt;Worked example&lt;/h2&gt;
&lt;p&gt;Python does the arithmetic:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;python&quot;&gt;&lt;code&gt;import math
G, c = 6.674e-11, 2.998e8                  # SI units
hbar, kB = 1.0546e-34, 1.3807e-23
M_sun, M_earth = 1.989e30, 5.972e24

def r_s(M):
    return 2 * G * M / c**2                # Schwarzschild radius, metres

def T_hawking(M):
    return hbar * c**3 / (8 * math.pi * G * kB * M)

print(f&amp;quot;Sun   r_s = {r_s(M_sun)/1000:.2f} km&amp;quot;)
print(f&amp;quot;Earth r_s = {r_s(M_earth)*1000:.2f} mm&amp;quot;)
print(f&amp;quot;you   r_s = {r_s(70):.1e} m  (70 kg)&amp;quot;)
print(f&amp;quot;Sun mean density at r_s = {M_sun/(4/3*math.pi*r_s(M_sun)**3):.1e} kg/m3&amp;quot;)
print(f&amp;quot;Hawking T of a solar-mass hole = {T_hawking(M_sun):.1e} K&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;Sun   r_s = 2.95 km
Earth r_s = 8.87 mm
you   r_s = 1.0e-25 m  (70 kg)
Sun mean density at r_s = 1.8e+19 kg/m3
Hawking T of a solar-mass hole = 6.2e-08 K&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So the Sun would have to be squeezed into a ball of &lt;strong&gt;2.95 km&lt;/strong&gt; radius, and Earth into one of &lt;strong&gt;8.9 mm&lt;/strong&gt;, the size of a pea. A good rule of thumb: about 3 km per solar mass. For you, it comes to 10^-25 m, billions of times smaller than a proton.&lt;/p&gt;
&lt;div class=&quot;tbl-wrap&quot;&gt;&lt;table class=&quot;mdtbl&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Object&lt;/th&gt;&lt;th&gt;Mass&lt;/th&gt;&lt;th&gt;Schwarzschild radius&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Moon&lt;/td&gt;&lt;td&gt;7.3 x 10^22 kg&lt;/td&gt;&lt;td&gt;0.11 mm&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Earth&lt;/td&gt;&lt;td&gt;6.0 x 10^24 kg&lt;/td&gt;&lt;td&gt;8.9 mm&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sun&lt;/td&gt;&lt;td&gt;1 solar mass&lt;/td&gt;&lt;td&gt;2.95 km&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Merger remnant of GW150914&lt;/td&gt;&lt;td&gt;62 solar masses&lt;/td&gt;&lt;td&gt;183 km&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sagittarius A*&lt;/td&gt;&lt;td&gt;about 4 million solar masses&lt;/td&gt;&lt;td&gt;about 12 million km (0.08 AU)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;M87*&lt;/td&gt;&lt;td&gt;about 6.5 billion solar masses&lt;/td&gt;&lt;td&gt;about 19 billion km (128 AU)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;The radius grows with the mass, but the volume grows with its cube, so bigger black holes are &lt;em&gt;less&lt;/em&gt; dense. The Sun squeezed into 2.95 km would have 1.8 x 10^19 kg/m3, some 80 times the density of an atomic nucleus. The average density inside M87*&amp;#039;s horizon is only about 0.4 kg/m3, a third of the density of air.&lt;/p&gt;
&lt;h2 id=&quot;warped-space-and-the-horizon&quot;&gt;Warped space and the horizon&lt;/h2&gt;
&lt;p&gt;In general relativity, mass tells space-time how to curve, and curved space-time tells things how to move. The old picture is a rubber sheet with balls on it. It is a cartoon, but a useful one:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;______
      \_______________________           /________                /_____
                              \_      /__         \___          /_
                                \_  /_                \        /
                                  \_                   \      /
                                                        \    |
                                                         |   |
                         walls keep steepening -&amp;gt;        |   |
                                                         |   |
                                                         |  |
                                                          | |
                                                          | |
                                                          | |
                                                          |_
      planet                   star                  black hole&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A planet makes a shallow dent, a star a deeper one. A black hole is a dent so deep that, within the &lt;strong&gt;event horizon&lt;/strong&gt; at the Schwarzschild radius, every possible path leads inward. The horizon is not a surface made of matter. It is a boundary: events inside cannot send any signal to the outside. At its centre, classical general relativity predicts a &lt;strong&gt;singularity&lt;/strong&gt; of infinite density. Most physicists read that as the theory breaking down and expect a quantum theory of gravity to replace it.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                                    ^
  o  event horizon (1 rs)           |    #  inner disk edge (3 rs)
  :  photon sphere (1.5 rs)         |    =- hot, glowing gas
  *  singularity (?)                |    |  jet along the spin axis
                                    |
                      ............................
               ......------------------------------......
          .....----------======================----------.....
       .....-------==========##############==========-------.....
     .....------=======###### :::oooooo::: ######=======------.....
    ....-------======####     : oo    oo :     ####======-------....
    ....------======####      : o   *  oo::     ####======------....
    ....-------======####     : oo    oo :     ####======-------....
     .....------=======###### :::oooooo::: ######=======------.....
       .....-------==========##############==========-------.....
          .....----------======================----------.....
               ......------------------------------......
                      ............................
                                    |
 to scale in radius:                |
 1 rs = 4 columns                   |
                                    |
                                    v&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Two myths deserve correcting. First, black holes do not &amp;quot;suck&amp;quot;. Replace the Sun with a black hole of the same mass and Earth keeps orbiting exactly as before, only in the dark and the cold. Gravity is extreme only near the horizon. Second, falling in is not equally deadly everywhere. Across your own height (2 m), the difference in pull at the horizon of a 10-solar-mass hole would be about 20 million times Earth&amp;#039;s gravity: you would be torn apart before arriving. At Sagittarius A* it would be about 1/10,000 of Earth&amp;#039;s gravity, and at M87* negligible, so you would cross without noticing, with no way back. Seen from outside, you would appear to slow down and fade, never quite reaching the horizon.&lt;/p&gt;
&lt;h2 id=&quot;where-black-holes-come-from&quot;&gt;Where black holes come from&lt;/h2&gt;
&lt;p&gt;A massive star ends its life when its core can no longer hold itself up. If the remaining core exceeds roughly two to three solar masses, no known force stops the collapse and a &lt;strong&gt;stellar black hole&lt;/strong&gt; forms. The Sun will not make one; it will end as a white dwarf, billions of years from now. The progenitor stars must be much heavier, very roughly 20 solar masses or more (the exact threshold is uncertain). Stellar black holes weigh from a few to some tens of solar masses; in 2020, gravitational waves revealed one of about 140 solar masses, described as the first clear &amp;quot;intermediate&amp;quot; case. At the centres of most large galaxies sit &lt;strong&gt;supermassive black holes&lt;/strong&gt;, millions to billions of solar masses. How they grew so big so early is an open problem, since the James Webb telescope keeps finding massive ones in the young universe.&lt;/p&gt;
&lt;p&gt;The best evidence for the one at the heart of our Milky Way came from tracking a star called S2. It circles an invisible point in 16 years and passes it at about 7,650 km/s, 2.5 percent of the speed of light. Kepler&amp;#039;s laws turn that orbit into a mass of about 4 million Suns packed within the 120 AU of S2&amp;#039;s closest approach. Reinhard Genzel and Andrea Ghez shared the 2020 Nobel Prize in Physics for this, together with Roger Penrose, who showed that black hole formation is a robust prediction of general relativity.&lt;/p&gt;
&lt;h2 id=&quot;2015-the-ripples&quot;&gt;2015: the ripples&lt;/h2&gt;
&lt;p&gt;On 14 September 2015 the two LIGO detectors in the United States, each with arms 4 km long, recorded a signal later named GW150914. Two black holes of about 36 and 29 solar masses had spiralled together and merged, 1.3 billion light-years away. About 3 solar masses of mass were turned into gravitational waves in a fraction of a second. By the time they reached Earth they changed the length of each arm by about 4 x 10^-18 m, roughly 1/200 of a proton&amp;#039;s radius.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                                                    *
                                                *  **
                                          **   **  **
    ***        ***       ***      ***    ***   *** **  *
    * **       * **      * **    ** *    * *   * * ** **
   *   **     **  **    **  *    *  **   * *   * * ** * * **
   *----*----**----*----*---**---*---*--*---*-**-*-*-**-***************
         *   *     **  **    *  **   *  *   * *  * * ** **  *
         ** **      * **     ** *    ** *   * *  * * ** **
          ***       ***       ***     ***   ***  * * **
                                      **     **  **  **
                                                  *  *

           inspiral: faster, louder                 merger
                                                         ringdown
Schematic. GW150914: ~0.2 s long, rising from 35 to 250 Hz.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The signal climbed from 35 to 250 Hz in 0.2 seconds, which in a loudspeaker sounds like a chirp. Announced on 11 February 2016, it was the first direct detection of gravitational waves and the first observation of a binary black hole. The 2017 Nobel Prize went to Rainer Weiss, Barry Barish and Kip Thorne. Since then the detectors have logged well over a hundred merger candidates, and the catalogue keeps growing.&lt;/p&gt;
&lt;h2 id=&quot;2019-and-2022-portraits&quot;&gt;2019 and 2022: portraits&lt;/h2&gt;
&lt;p&gt;The Event Horizon Telescope links radio dishes across the Earth into one virtual telescope observing at 1.3 mm wavelength. On 10 April 2019 it released the first image of a black hole, M87*, 55 million light-years away. On 12 May 2022 it followed with Sagittarius A*, 26,000 light-years away. Each shows a bright, lopsided ring around a dark centre. The rings measure about 42 and 52 micro-arcseconds across, the angle of an orange on the Moon (43 micro-arcseconds). The two look alike in size even though M87* is 1,600 times heavier, because it is also about 2,000 times farther away.&lt;/p&gt;
&lt;p&gt;The ring is hot gas whose light is bent by gravity; the dark centre is the &lt;strong&gt;shadow&lt;/strong&gt;, about 2.6 times the horizon&amp;#039;s radius, because light passing too close is captured. So the picture is not a photo of the horizon itself. What matters is that the measured size agrees with general relativity&amp;#039;s prediction for the known mass.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;A. Sgr A* (about 4 million Suns): 1 column = 0.0065 AU
0.0           0.1             0.2            0.3             0.4  AU
##############-+---------------+--------------+-------------M-+---------
#### horizon radius, 0.08 AU           M Mercury&amp;#039;s orbit, 0.39 AU

B. M87* (about 6.5 billion Suns): 1 column = 2 AU
0        20        40        60        80        100       120      AU
###############N#################################################-------
#### horizon radius, 128 AU        N Neptune&amp;#039;s orbit, 30 AU
The Solar System out to the Kuiper belt (50 AU) fits inside it.&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;hawking-radiation-a-theory&quot;&gt;Hawking radiation, a theory&lt;/h2&gt;
&lt;p&gt;In 1974 Stephen Hawking showed that quantum effects near a horizon should make a black hole glow very faintly, as if it had a temperature, T = hbar c^3 / (8 pi G M k). For a solar-mass hole that is 6 x 10^-8 K, far colder than the 2.7 K microwave background, so every real black hole today absorbs more than it emits. A solar-mass hole would need some 2 x 10^67 years to evaporate, against a universe 1.4 x 10^10 years old. Only tiny hypothetical relics, below about 10^11 to 10^12 kg, could be finishing their evaporation now. None has been seen.&lt;/p&gt;
&lt;p&gt;So Hawking radiation is a prediction, trusted because it links gravity, quantum theory and thermodynamics so neatly, but never observed. It also leads to the &lt;strong&gt;information paradox&lt;/strong&gt;: if a black hole evaporates, what happens to what fell in? That is still unresolved.&lt;/p&gt;
&lt;h2 id=&quot;try-it&quot;&gt;Try it&lt;/h2&gt;
&lt;p&gt;Compute the Schwarzschild radius of a mountain with the snippet above. The same general relativity runs the whole cosmos in &lt;em&gt;How we know the universe is expanding&lt;/em&gt;. Black holes in our galaxy can also be found by the wobble they cause in a companion star, as in &lt;em&gt;Exoplanets: how we find other worlds&lt;/em&gt;, and &lt;em&gt;A tour of the solar system&lt;/em&gt; gives a feel for what &amp;quot;128 AU&amp;quot; means.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Life&#039;s origin: what we know and what we don&#039;t</title>
    <link>https://ozdc.us/p/lifes-origin-what-we-know-and-what-we-dont/</link>
    <guid isPermaLink="true">https://ozdc.us/p/lifes-origin-what-we-know-and-what-we-dont/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Mon, 20 Apr 2026 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>biology</category>
    <category>origin-of-life</category>
    <category>essay</category>
    <description>&lt;p&gt;How did chemistry become biology? This is one of the few big questions where honest scientists answer &amp;quot;we do not know&amp;quot;. But that answer hides a lot of structure. Some parts are &lt;strong&gt;known&lt;/strong&gt; (measured, repeated), some are &lt;strong&gt;hypotheses&lt;/strong&gt; (coherent stories with partial support) and some are &lt;strong&gt;unknown&lt;/strong&gt;. In this post every claim carries one of those three labels.&lt;/p&gt;
&lt;p&gt;In &lt;em&gt;The universe in one year: a cosmic calendar&lt;/em&gt; the Earth forms on 2 September and clear traces of life exist by 30 September. That is about 28 calendar days, or a billion years. This post zooms into that month.&lt;/p&gt;
&lt;h2 id=&quot;what-needs-explaining&quot;&gt;What needs explaining&lt;/h2&gt;
&lt;p&gt;A common working definition, used by NASA, is that life is a self-sustaining chemical system capable of Darwinian evolution. Every living cell has three parts: a &lt;strong&gt;boundary&lt;/strong&gt; (a membrane), a &lt;strong&gt;metabolism&lt;/strong&gt; (energy flowing through chemistry) and &lt;strong&gt;heredity&lt;/strong&gt; (information that can be copied). Evolution, as described in &lt;em&gt;Five ideas that built modern science&lt;/em&gt;, starts to work once heredity exists. The origin of life is the earlier question of how those three parts came together. Pasteur&amp;#039;s flask experiments of the 1860s showed that life today comes only from life, so the first cell was a one-off event in the deep past.&lt;/p&gt;
&lt;h2 id=&quot;the-earliest-evidence&quot;&gt;The earliest evidence&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;Ga = billions of years ago.  * planet  # life, firm  ? life, disputed
   4.6     4.4     4.2     4.0     3.8     3.6     3.4     3.2     3.0
    +-------+-------+-------+-------+-------+-------+-------+-------+
      * Earth forms (4.54)  :               :               :
        * Moon-forming impact (about 4.5)   :               :
            * oldest zircons: liquid water? (4.4)           :
            :           ? carbon flake in zircon (4.1)      :
            :               :       ? carbon isotopes, Isua (3.8)
            :               :           ? Isua stromatolite claim (3.7)
            :      Dresser stromatolites (3.48)  #          :
            :  Strelley Pool stromatolites (3.43)  #        :
               [========] LUCA, one model estimate (4.2)

            &amp;lt;-----------------------------------&amp;gt;
            time available for life to begin: up to 900 million years&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Known.&lt;/strong&gt; The Earth formed 4.54 billion years ago. Tiny zircon crystals from Jack Hills in Western Australia are up to 4.4 billion years old, and their oxygen isotopes suggest they formed in contact with liquid water (an interpretation that is still debated).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Known, with debate.&lt;/strong&gt; The firmest traces of life are &lt;em&gt;stromatolites&lt;/em&gt;, layered mounds built by microbial mats, in the Pilbara of Western Australia: the Dresser Formation (about 3.48 billion years) and Strelley Pool (3.43). Most specialists accept them, though layered rock can form without life, and the 1993 claim of 3.46-billion-year-old &amp;quot;microfossils&amp;quot; in the Apex chert was later challenged as mineral artefacts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Contested.&lt;/strong&gt; Carbon with a life-like isotope signature and structures claimed to be stromatolites in Isua, Greenland (3.7 to 3.8 billion years; the structures were disputed in 2018), and a carbon flake inside a 4.1-billion-year-old zircon (2015) that may be contamination or not biological.&lt;/p&gt;
&lt;p&gt;So: life by about 3.5 billion years ago is solid, 3.7 to 3.8 is possible, and anything older is speculation. The window between the first likely oceans and firm evidence is up to 900 million years, but it says nothing about how long the origin itself took. It could have been quick.&lt;/p&gt;
&lt;h2 id=&quot;miller-and-urey-building-blocks-are-easy&quot;&gt;Miller and Urey: building blocks are easy&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;              +------------------------------+
              | SPARK CHAMBER (5 L flask)    |
              | CH4 + NH3 + H2 + steam       |-------+
              | ** sparks = &amp;quot;lightning&amp;quot; **   |       |  gas + steam
              +------------------------------+       |
                    ^                                v
                    | steam rises             +--------------------+
                    |                         | CONDENSER          |
                    |                         | cold water jacket  |
      +----------------------------+          +--------------------+
      | BOILING WATER              |                 |
      | the &amp;quot;ocean&amp;quot;, heated        |                 |  cooled: falls
      +----------------------------+                 |  back as &amp;quot;rain&amp;quot;
                             ^                       v
                             |          +------------------------+
                             +----------&amp;lt; TRAP: products collect |
                                        +------------------------+

 Run for one week in 1952: the water turned red-brown, and the
 flask and trap contained amino acids (glycine, alanine and more).&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In 1952 a 22-year-old graduate student, &lt;strong&gt;Stanley Miller&lt;/strong&gt;, worked with &lt;strong&gt;Harold Urey&lt;/strong&gt; at the University of Chicago to test an idea from Oparin and Haldane in the 1920s: that sunlight and lightning on a primitive atmosphere could make the molecules of life. Water, methane, ammonia and hydrogen went in; sparks stood for lightning. After a week the water was red-brown and held amino acids (the paper appeared in &lt;em&gt;Science&lt;/em&gt; on 15 May 1953). In 2008, a reanalysis of samples Miller had stored from a 1958 version of the experiment, run with hydrogen sulfide, found more than 20.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Known:&lt;/strong&gt; organic molecules central to life form easily from simple ingredients plus energy. &lt;strong&gt;Revised:&lt;/strong&gt; the early atmosphere was probably less rich in methane and ammonia (more carbon dioxide and nitrogen) than Miller assumed, which lowers yields, so his exact recipe is doubtful. The conclusion survives because nature makes them elsewhere. The Murchison meteorite, which fell in Australia in 1969, holds more than 70 amino acids. Samples from the asteroids Ryugu and Bennu, returned to Earth in 2020 and 2023, contain amino acids and nucleobases, the &amp;quot;letters&amp;quot; of RNA and DNA; the 2025 Bennu results report 14 of the 20 protein amino acids and all five bases.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unknown:&lt;/strong&gt; why life uses only left-handed amino acids. Laboratory syntheses make a 50-50 mix, and some meteorites show only a small excess of one hand. And building blocks are not life: a heap of bricks is not a cathedral.&lt;/p&gt;
&lt;h2 id=&quot;the-rna-world&quot;&gt;The RNA world&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+--------------------------------+
| simple molecules: HCN, H2S,    |
| formaldehyde, phosphate        |   KNOWN: labs, meteorites
+--------------------------------+
                 v
+--------------------------------+
| nucleotides, the RNA letters   |   PARTLY: Sutherland 2009+
+--------------------------------+
                 v
+--------------------------------+
| short RNA strands form         |   PARTLY: short chains only
+--------------------------------+
                 v
+--------------------------------+
| an RNA enzyme copies RNA       |
| (a replicase)                  |   OPEN: no full self-copy yet
+--------------------------------+
                 v
+--------------------------------+
| strands inside a fatty-acid    |
| bubble (protocell)             |   PARTLY: bubbles form easily
+--------------------------------+
                 v
+--------------------------------+
| copying errors + selection     |
| = Darwinian evolution          |   KNOWN for RNA in test tubes
+--------------------------------+
                 v
+--------------------------------+
| RNA + peptides, then           |
| DNA + proteins (to LUCA)       |   OPEN: origin of the code
+--------------------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;The problem.&lt;/strong&gt; In cells, DNA stores instructions and proteins do the work, but copying DNA needs proteins and making proteins needs DNA. Which came first? RNA can do both jobs. In the early 1980s &lt;strong&gt;Thomas Cech&lt;/strong&gt; and &lt;strong&gt;Sidney Altman&lt;/strong&gt; found RNA molecules that act as enzymes (Nobel Prize 1989), and the core of the ribosome, the machine that builds every protein, turned out to be RNA (structures solved around 2000, Nobel Prize 2009). &lt;strong&gt;Walter Gilbert&lt;/strong&gt; named the idea the &lt;em&gt;RNA world&lt;/em&gt; in 1986.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hypothesis&lt;/strong&gt;, with real pieces of support. In 2009 &lt;strong&gt;John Sutherland&amp;#039;s&lt;/strong&gt; group made the activated building blocks of RNA from simple compounds by a route that avoids older dead ends, and in 2015 a network driven by ultraviolet light produced precursors of RNA, proteins and fats together. Evolved ribozymes can copy short stretches of RNA and, in a 2009 experiment by Lincoln and Joyce, a pair of them assembled each other from ready-made pieces. But none has copied itself from single letters.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Problems.&lt;/strong&gt; RNA is fragile in water, strands stick to their copies, and copying errors pile up. On the compartment side, &lt;strong&gt;Jack Szostak&amp;#039;s&lt;/strong&gt; group showed that bubbles of fatty acids grow and divide by themselves, and that RNA trapped inside can be copied a little without enzymes. Alternatives treat &lt;strong&gt;metabolism first&lt;/strong&gt; (energy-releasing chemistry, perhaps on mineral surfaces, before genes) or &lt;strong&gt;compartments first&lt;/strong&gt;, and many researchers expect the truth to be a mixture.&lt;/p&gt;
&lt;h2 id=&quot;vents-or-ponds&quot;&gt;Vents or ponds?&lt;/h2&gt;
&lt;p&gt;In 1871 Darwin wrote to the botanist Joseph Hooker about a &amp;quot;warm little pond&amp;quot; with ammonia, phosphates, light, heat and electricity in which a protein might form. Ocean-floor vents offered a rival after 1977, when scientists found life thriving around them, and in 1979 hot &amp;quot;black smokers&amp;quot; at about 350 degrees Celsius.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+--------------+-----------------+--------------------+----------------+
| SCENARIO     | ENERGY          | FOR                | AGAINST        |
+--------------+-----------------+--------------------+----------------+
| Alkaline     | H2 and CO2      | resembles the core | very dilute;   |
| vent (Lost   | chemistry;      | metabolism of      | RNA letters    |
| City type)   | natural proton  | cells; warm and    | not shown to   |
|              | gradient across | stable             | form; long     |
|              | thin walls      |                    | chains hard in |
|              |                 |                    | water          |
+--------------+-----------------+--------------------+----------------+
| Hot black    | 350 C fluid,    | rich in metals and | too hot:       |
| smoker       | acidic          | sulfur             | breaks organic |
|              |                 |                    | molecules      |
|              |                 |                    | apart          |
+--------------+-----------------+--------------------+----------------+
| Warm pond or | sunlight (UV),  | cycles concentrate | needs dry land |
| hot spring   | lightning, wet- | and join           | at about 4 Ga; |
|              | dry cycles      | molecules; UV      | rain dilutes;  |
|              |                 | drives RNA-        | UV also        |
|              |                 | precursor          | destroys       |
|              |                 | chemistry          |                |
+--------------+-----------------+--------------------+----------------+
| Ice          | freezing        | RNA copying works  | cold slows     |
|              | squeezes        | better in ice in   | reactions;     |
|              | solutes         | the lab            | little energy  |
|              | together        |                    |                |
+--------------+-----------------+--------------------+----------------+
| Delivery     | impacts         | meteorites carry   | supplies parts |
| from space   |                 | amino acids and    | only; moves    |
|              |                 | bases              | the question   |
|              |                 |                    | elsewhere      |
+--------------+-----------------+--------------------+----------------+&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The vent case rests on &lt;strong&gt;Lost City&lt;/strong&gt;, found in 2000 near the Mid-Atlantic Ridge: warm, alkaline towers up to 60 m tall, powered by water reacting with mantle rock (the ridge machinery of &lt;em&gt;Plate tectonics: the moving ground&lt;/em&gt;). Hydrogen and methane flow through porous walls, creating a natural chemical gradient that is strikingly like the one cells use to make energy. The pond case rests on wet-dry cycles that concentrate and join molecules, and on ultraviolet chemistry that makes RNA precursors. Both are &lt;strong&gt;hypotheses&lt;/strong&gt;; neither has produced anything alive. Which is more likely is &lt;strong&gt;unknown&lt;/strong&gt;, and a mixture of sites is possible.&lt;/p&gt;
&lt;h2 id=&quot;luca&quot;&gt;LUCA&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;LUCA&lt;/strong&gt; is the Last Universal Common Ancestor: the population from which all living cells descend. It is &lt;em&gt;not&lt;/em&gt; the first life. Its relatives left no descendants. We infer it because every cell shares the same genetic code, the same ribosome and the same energy currency. In 2016 &lt;strong&gt;Madeline Weiss&lt;/strong&gt; and colleagues traced 355 gene families back to it and pictured a microbe living on hydrogen and carbon dioxide without oxygen, possibly near vents. In 2024 &lt;strong&gt;Edmund Moody&lt;/strong&gt; and colleagues, using molecular clocks, put LUCA at about 4.2 billion years ago, with roughly 2,600 proteins and even a primitive immune system. This is a &lt;strong&gt;hypothesis&lt;/strong&gt; and many experts doubt it, as it would mean a complex cell only some 300 million years after the Moon formed. Estimates of this kind carry wide error bars.&lt;/p&gt;
&lt;h2 id=&quot;the-ledger&quot;&gt;The ledger&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Known (with some debate):&lt;/strong&gt; liquid water probably existed by 4.4 billion years ago; life existed by 3.5; amino acids and RNA bases form readily and arrive on meteorites; RNA can store information and catalyse; RNA evolves in test tubes; all cells share one ancestor.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Hypothesis:&lt;/strong&gt; an RNA world, or metabolism first, or a mixture; vents, ponds or both; LUCA&amp;#039;s age and size.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Unknown:&lt;/strong&gt; how RNA letters formed and joined in a real place; how the first copier arose; how the genetic code arose; how long it took; why life uses one handedness; whether it happened once or many times; whether it is common in the universe.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;That last question is limited by having only one example. Every living thing we know shares one ancestor. If we find a second origin, on Mars, under the ice of Europa or Enceladus, or in a lab, the problem changes completely. Until then, the best summary is an honest one. The parts list is largely known, the assembly instructions are not, and the next 3.5 billion years, which produced everything in &lt;em&gt;Nature as engineer: what nature teaches us&lt;/em&gt;, are the easy part by comparison.&lt;/p&gt;</description>
  </item>
  <item>
    <title>The revolutions of our time</title>
    <link>https://ozdc.us/p/the-revolutions-of-our-time/</link>
    <guid isPermaLink="true">https://ozdc.us/p/the-revolutions-of-our-time/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Thu, 09 Apr 2026 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>history</category>
    <category>philosophy</category>
    <category>essay</category>
    <description>&lt;p&gt;Every few years someone announces that everything has changed. Sometimes they are right. In 1543 a book moved the Earth out of the centre of the universe. In 2012 a paper showed how to cut DNA at a chosen spot. In late 2022 a chatbot became a household word. This post asks what makes a revolution, tours the big ones, and ends with a checklist for the next announcement. I am writing in spring 2026, so the last part is a snapshot, not a verdict.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;------------+-----------+------------+-----------+------------+---------
year       1600        1700         1800        1900         2000

    o 1543 Copernicus: the Earth moves
                      o 1687 Newton: Principia
             1859 Darwin: natural selection o
           1905 Einstein: relativity (1905, 1915) o
                   1925 Quantum mechanics (1900-27) o
                                  1953 DNA double helix o
                    1971 Microprocessor (transistor 1947) o
                                    2012 CRISPR, deep learning o
                                                   2022 ChatGPT o
------------+-----------+------------+-----------+------------+---------
(a handpicked list. Gaps look shorter near the present partly because
 recent history is better documented and not yet sorted out)&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;kuhn-s-picture&quot;&gt;Kuhn&amp;#039;s picture&lt;/h2&gt;
&lt;p&gt;The physicist and historian &lt;strong&gt;Thomas Kuhn&lt;/strong&gt; gave the best-known account in &lt;em&gt;The Structure of Scientific Revolutions&lt;/em&gt; (1962). Most of the time, he said, scientists do &lt;strong&gt;normal science&lt;/strong&gt;: solving puzzles inside a shared &lt;strong&gt;paradigm&lt;/strong&gt;, meaning accepted theories, methods and standard examples. It is like writing code against a stable ABI. Sometimes a result does not fit. Most such &lt;strong&gt;anomalies&lt;/strong&gt; are set aside as errors or puzzles to solve later. If enough pile up, confidence erodes into a &lt;strong&gt;crisis&lt;/strong&gt;, a rival paradigm appears, and over time it wins and becomes the new normal.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+----------------------+                        +----------------------+
|    NORMAL SCIENCE    |    most are set aside  |      ANOMALIES       |
|  solving puzzles in  |-----------------------&amp;gt;| results the paradigm |
|  a shared paradigm   |                        |    cannot explain    |
+----------------------+                        +----------+-----------+
           ^                             too many pile up  |
           |  textbooks are rewritten                      |
           |                                               v
+----------+-----------+                        +----------------------+
|     NEW PARADIGM     |                        |        CRISIS        |
| a new way of seeing  |                        |  confidence erodes,  |
|   and new puzzles    |                        |    rivals appear     |
+----------------------+                        +----------+-----------+
           ^                                               |
           |  the winner becomes                           |
           |  the new normal           a rival paradigm    |
+----------+-----------+               gains followers     |
|      REVOLUTION      |                                   |
|   rival paradigms    |&amp;lt;----------------------------------+
|       compete        |
+----------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Kuhn&amp;#039;s most debated idea is &lt;strong&gt;incommensurability&lt;/strong&gt;: rival paradigms can disagree about what counts as a problem or a good answer, so no neutral referee settles the matter by logic alone. Critics were many. Karl Popper thought good scientists test theories critically all the time, not only in crises. Imre Lakatos offered &amp;quot;research programmes&amp;quot; instead. Some read Kuhn as making science irrational, which he denied, listing values such as accuracy, consistency, scope, simplicity and fruitfulness. Historians add that real transitions are slower and messier than the cycle suggests. Treat it as a lens, not a law.&lt;/p&gt;
&lt;p&gt;By Kuhn&amp;#039;s standard, a revolution is more than something new. It changes which questions are asked, which answers count, and what the textbooks teach. &amp;quot;Paradigm shift&amp;quot; is now applied to every product launch, but most of those fail the test.&lt;/p&gt;
&lt;h2 id=&quot;a-tour-of-seven-revolutions&quot;&gt;A tour of seven revolutions&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Copernican (1543).&lt;/strong&gt; Nicolaus Copernicus put the Sun at the centre. He was not the first to suggest it (Aristarchus of Samos did, in the 3rd century BCE), and his model still used circles and was no more accurate than Ptolemy&amp;#039;s. It won over decades, helped by Kepler&amp;#039;s ellipses (1609) and Galileo&amp;#039;s telescope (1610).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Newtonian (1687).&lt;/strong&gt; Newton&amp;#039;s &lt;em&gt;Principia&lt;/em&gt; gave one set of laws for falling apples and orbiting moons. Its predictions were bold: the return of Halley&amp;#039;s comet in 1758, and the planet Neptune, found in 1846 from its pull on Uranus. The anomaly that eventually undid it was tiny: Mercury&amp;#039;s orbit drifts by 43 arcseconds per century more than Newton predicts, which Einstein&amp;#039;s general relativity explained in 1915.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Darwinian (1859).&lt;/strong&gt; Natural selection, announced with Wallace in 1858, explained the diversity of life without a design plan. The mechanics of inheritance only caught up in the 20th century. The details are in &lt;em&gt;Evolution, illustrated&lt;/em&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Relativity and quantum (1900-1927).&lt;/strong&gt; Planck (1900), Einstein (1905, 1915), Heisenberg (1925) and Schrödinger (1926) rebuilt physics. GPS satellites need relativistic clock corrections of about 38 millionths of a second per day, and quantum theory underlies transistors and lasers. The two theories still do not fit together into one, and puzzles such as dark matter are anomalies whose outcome is not yet clear.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Genetic (1953-2023).&lt;/strong&gt; Watson and Crick published the double helix in 1953, building on X-ray images made by Rosalind Franklin and Raymond Gosling. The Human Genome Project declared its work done in 2003, and a gap-free genome followed in 2022. CRISPR as an editing tool (Doudna and Charpentier, 2012; Nobel Prize 2020) led to the first approved therapy, for sickle cell disease, in 2023.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Digital (1936-2007).&lt;/strong&gt; Turing&amp;#039;s computability paper (1936), the transistor (1947), Shannon&amp;#039;s information theory (1948), the integrated circuit (1958), the microprocessor (1971), the web (1989-91) and the smartphone (2007). It also changed science itself: simulation and data analysis became a third way to do research, beside theory and experiment.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;AI (2012-now).&lt;/strong&gt; Neural networks date from the 1950s. What changed was data, computing power and architecture: an image-recognition breakthrough in 2012, the transformer in 2017, ChatGPT in November 2022. The 2024 Nobel Prizes honoured work behind neural networks (Physics: Hopfield and Hinton) and protein prediction and design (Chemistry: Hassabis, Jumper and Baker).&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;not-all-revolutions-are-the-same-kind&quot;&gt;Not all revolutions are the same kind&lt;/h2&gt;
&lt;p&gt;Kuhn&amp;#039;s cycle describes changes in &lt;em&gt;explanation&lt;/em&gt;. The digital and AI revolutions are mostly changes in &lt;em&gt;capability&lt;/em&gt;, and their effects land on society. Telling the layers apart avoids a lot of confusion.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+------------------+      +------------------+      +------------------+
|     EXPLAINS     |      |     ENABLES      |      |   REORGANISES    |
|   a new theory   |-----&amp;gt;|    a new tool    |-----&amp;gt;| work, money, war |
+------------------+      +------------------+      +------------------+

 quantum theory      ---&amp;gt;  transistor          ---&amp;gt;  computers, phones
 DNA structure       ---&amp;gt;  sequencing, CRISPR  ---&amp;gt;  medicine, farming
 Maxwell&amp;#039;s equations ---&amp;gt;  radio, radar        ---&amp;gt;  telecom, navigation

Kuhn&amp;#039;s cycle describes the first column. The lag between columns is
often decades, and it can run backwards: the telescope and the steam
engine came before the theories that explained them.&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;real-change-versus-hype&quot;&gt;Real change versus hype&lt;/h2&gt;
&lt;p&gt;Roy Amara&amp;#039;s rule of thumb says we overestimate a technology&amp;#039;s effect in the short run and underestimate it in the long run. Analysts popularised a schematic &amp;quot;hype cycle&amp;quot; in the 1990s. Both fit the dot-com episode: the Nasdaq index fell by roughly three-quarters between 2000 and 2002, yet the web went on to change nearly everything. Economists also noticed that computers did not show up in productivity statistics for years (Robert Solow&amp;#039;s remark of 1987). The historian Paul David pointed out that electric motors took decades to pay off, until factories were redesigned around them.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;effect |          (1)                                  (4)
on the |           ***                                         ooooo
world  |          *   *                                  oooooo
       |         *     *                              ooo
       |        *                                  ooo
       |                *                        oo
       |       *         *                     oo
       |      *                              oo
       |     *            *                oo                     **
       |    *              **     (2)    oo             **********
       |  **                 **       ooo    ***********
       |**                     ****###*******
       |                        ooo
       |                oooooooo        (3)
       |oooooooooooooooo
       +------------------------------------------------------------
                                                            time -&amp;gt;

  *  what people expect          o  what actually changes
  (1) a striking demo; everyone extrapolates it in a straight line
  (2) the failures show up; the story turns to disappointment
  (3) slow work: new tools, standards, habits, rebuilt institutions
  (4) late on, the effects exceed what anyone was claiming
  (schematic, not data; # = the two curves cross)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Why do smart people misjudge this? Because demos are cheap and deployment is expensive. A demo is like a proof-of-concept exploit that works on the author&amp;#039;s machine: it proves that something is possible, not that it is reliable, affordable or safe at scale. The gap is filled with standards, training, regulation and habit, and that work is slow.&lt;/p&gt;
&lt;p&gt;So how do we judge a claim in the moment? Here is a checklist.&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Is there a mechanism, or just a demo?&lt;/strong&gt; A result you cannot explain is an anomaly, not yet a theory.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Has it been measured independently?&lt;/strong&gt; Cold fusion (1989) is the classic non-replication.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Does it predict something new that came true?&lt;/strong&gt; Halley&amp;#039;s comet, Neptune, the bending of starlight in 1919 (the original data are messier than the legend, but later measurements confirm the effect) and gravitational waves (2015) all passed.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Does it survive hostile testing?&lt;/strong&gt; Ask people who want it to fail.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;What are the base rates?&lt;/strong&gt; Most announced revolutions fade.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Who profits from belief?&lt;/strong&gt; Theranos is the cautionary tale.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;What would change my mind?&lt;/strong&gt; If nothing could, it is not an assessment.&lt;/li&gt;&lt;/ol&gt;
&lt;h2 id=&quot;benefits-and-risks-fairly&quot;&gt;Benefits and risks, fairly&lt;/h2&gt;
&lt;p&gt;Every revolution above cut both ways. Physics gave medical imaging, nuclear power and, after fission was found in 1938, the bomb. Darwin&amp;#039;s theory was abused as &amp;quot;social Darwinism&amp;quot; and eugenics, though a description of how populations change says nothing about what we should value. Genetics offers a cure for a painful blood disease and the temptation of &amp;quot;designer babies&amp;quot;; in 2018 He Jiankui&amp;#039;s germline-edited children were condemned worldwide. The digital age brought open knowledge and also surveillance and misinformation.&lt;/p&gt;
&lt;p&gt;AI is the live case. Protein structures, translation and coding help are real gains. Open problems include confident errors, energy use, who benefits, bias, misuse and concentrated power. Serious experts disagree widely, from &amp;quot;another useful tool&amp;quot; to &amp;quot;the most consequential technology yet&amp;quot;, and some warn of severe long-term risks while others think attention should stay on present harms. I do not think anyone knows the trajectory, and I distrust anyone who sounds certain either way.&lt;/p&gt;
&lt;h2 id=&quot;closing&quot;&gt;Closing&lt;/h2&gt;
&lt;p&gt;For a reverse engineer, Kuhn is practical advice. Your tools and assumptions are your paradigm. The anomalies you set aside, a checksum that never matches or a field you called padding, are where the next finding hides. Hold the framework loosely enough to notice what it cannot explain, and tightly enough to get work done.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Five ideas that built modern science</title>
    <link>https://ozdc.us/p/five-ideas-that-built-modern-science/</link>
    <guid isPermaLink="true">https://ozdc.us/p/five-ideas-that-built-modern-science/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sun, 29 Mar 2026 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>history</category>
    <category>physics</category>
    <category>biology</category>
    <category>essay</category>
    <description>&lt;p&gt;Science is a huge pile of results, but a few ideas carry most of the weight. This is my list of five: a personal choice, not a ranking, built on Newton&amp;#039;s mechanics and mathematics as the foundation. For each idea I give the claim, the evidence, the people and what it made possible.&lt;/p&gt;
&lt;p&gt;They are not separate; the map shows how they hold each other up. The dating in &lt;em&gt;The universe in one year: a cosmic calendar&lt;/em&gt; rests on atoms and energy, and &lt;em&gt;Plate tectonics: the moving ground&lt;/em&gt; shows how slowly even a good idea can win.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;        +-- quantum theory explains atoms, bonds and light ----+
        v                                                      |
+---------------+ heat is  +---------------+ E = mc^2, +---------------+
| 1 ATOMS       | atoms in | 4 ENERGY      | energy in | 5 FIELDS      |
| matter comes  |&amp;lt;--------&amp;gt;| it is kept,   |&amp;lt;---------&amp;gt;| space is made |
| in particles  | motion   | it degrades   | fields    | of fields     |
+---------------+          +---------------+           +---------------+
        | DNA is a                 | the Sun&amp;#039;s age:            |
        | molecule                 | Kelvin v Darwin           |
        v                          v                           |
+---------------+ genes =  +---------------+                   |
| 2 CELLS+GENES | heredity | 3 EVOLUTION   |                   |
| life: units   |&amp;lt;--------&amp;gt;| variation and |                   |
| and a code    |          | selection     |                   |
+---------------+          +---------------+                   |
        ^                                                      |
        |                                                      |
        |                                                      |
        +---- X-rays, microscopes: fields reveal the cell -----+&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;1-atoms-matter-comes-in-lumps&quot;&gt;1. Atoms: matter comes in lumps&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The idea.&lt;/strong&gt; Everything is built from a small set of kinds of atoms, which combine in fixed patterns into molecules.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The evidence.&lt;/strong&gt; Greek thinkers such as Leucippus and Democritus guessed at atoms in the 5th century BCE, but evidence began with chemistry. &lt;strong&gt;John Dalton&lt;/strong&gt; (1803, published 1808) noticed that elements combine in small whole-number ratios by weight: 12 g of carbon takes either 16 g of oxygen (carbon monoxide) or 32 g (carbon dioxide), a ratio of 1 to 2, just what lumps would do. In 1869 &lt;strong&gt;Dmitri Mendeleev&lt;/strong&gt; arranged the elements in a table with gaps and predicted the missing ones; gallium (1875) and germanium (1886) turned up with the predicted properties.&lt;/p&gt;
&lt;p&gt;Doubters remained: around 1900 Ernst Mach still treated atoms as bookkeeping. The turning point was the jiggling of pollen grains in water, seen by Robert Brown in 1827. &lt;strong&gt;Einstein&lt;/strong&gt; showed in 1905 that unseen molecules bumping a grain would produce exactly that motion, with a testable formula. &lt;strong&gt;Jean Perrin&lt;/strong&gt; tested it in 1908, and the leading sceptic Wilhelm Ostwald conceded the next year. Then the atom was opened: &lt;strong&gt;J. J. Thomson&lt;/strong&gt; found the electron (1897) and &lt;strong&gt;Ernest Rutherford&amp;#039;s&lt;/strong&gt; team the nucleus (1909 to 1911), which is roughly a hundred-thousandth of the atom&amp;#039;s width.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Made possible.&lt;/strong&gt; Chemistry and materials, semiconductors, nuclear power, medicine. In 1989 IBM researchers pushed 35 xenon atoms into place, one by one, to spell their company&amp;#039;s name.&lt;/p&gt;
&lt;h2 id=&quot;2-cells-and-genes-life-has-units-and-a-code&quot;&gt;2. Cells and genes: life has units and a code&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The idea.&lt;/strong&gt; Living things are made of cells, and cells come only from cells. Heredity travels in discrete units, genes, made of DNA and read out as a four-letter code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The evidence.&lt;/strong&gt; &lt;strong&gt;Robert Hooke&lt;/strong&gt; coined &amp;quot;cell&amp;quot; in 1665 looking at cork. &lt;strong&gt;Schleiden and Schwann&lt;/strong&gt; (1838-39) extended it to all plants and animals, and &lt;strong&gt;Rudolf Virchow&lt;/strong&gt; put it in a sentence in 1855: every cell comes from a cell. Heredity needed counting. &lt;strong&gt;Gregor Mendel&lt;/strong&gt; crossed pea plants in the 1850s and 1860s and found that traits do not blend: they come in units that reshuffle in fixed proportions.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;              parent 2 passes on:
                  A           a
            +-----------+-----------+
            |           |           |   A = round seed (dominant)
parent 1  A |    AA     |    Aa     |   a = wrinkled seed (recessive)
passes on:  +-----------+-----------+
          a |    Aa     |    aa     |   3 round : 1 wrinkled
            +-----------+-----------+   Mendel counted 5,474 : 1,850
                                        = 2.96 : 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;His second-generation counts, 5,474 round to 1,850 wrinkled seeds, give 2.96 to 1. Nobody took notice until 1900. &lt;strong&gt;Thomas Hunt Morgan&amp;#039;s&lt;/strong&gt; fruit flies tied genes to chromosomes; in 1944 &lt;strong&gt;Avery, MacLeod and McCarty&lt;/strong&gt; showed that DNA carries them; in 1953 &lt;strong&gt;Watson and Crick&lt;/strong&gt; built the double helix, drawing on X-ray images by &lt;strong&gt;Rosalind Franklin&lt;/strong&gt; and Raymond Gosling. The code was broken by the mid-1960s, and the first gapless human genome appeared in 2022.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Made possible.&lt;/strong&gt; Insulin made by bacteria, DNA testing, gene editing with CRISPR (Doudna and Charpentier, 2012) and mRNA vaccines. The human genome has about 3.1 billion letters: at two bits each, roughly 775 megabytes, small enough for a memory stick.&lt;/p&gt;
&lt;h2 id=&quot;3-evolution-variation-inheritance-selection&quot;&gt;3. Evolution: variation, inheritance, selection&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The idea.&lt;/strong&gt; Species descend with modification from common ancestors, mainly through natural selection: individuals vary, some variation is inherited, more are born than survive, and the variants that fit their surroundings leave more descendants.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The evidence.&lt;/strong&gt; &lt;strong&gt;Charles Darwin&lt;/strong&gt; and &lt;strong&gt;Alfred Russel Wallace&lt;/strong&gt; reached the idea independently; their joint paper was read to the Linnean Society on 1 July 1858 and Darwin&amp;#039;s &lt;em&gt;On the Origin of Species&lt;/em&gt; appeared on 24 November 1859. Since then the evidence has come from every direction. Fossils appear in a sensible order; in 2004 a team searched 375-million-year-old rock on Ellesmere Island, because the theory said a fish with limbs should be there, and found &lt;em&gt;Tiktaalik&lt;/em&gt;. The same bones sit in a bat&amp;#039;s wing and your arm. And DNA gave the strongest test: all life shares one code, and humans and other primates carry the &lt;em&gt;same&lt;/em&gt; broken copy of a gene for making vitamin C, a scar easy to explain by descent and hard to explain otherwise.&lt;/p&gt;
&lt;p&gt;You can also watch it. After the drought of 1977 on the Galápagos island Daphne Major, the surviving finches studied by &lt;strong&gt;Peter and Rosemary Grant&lt;/strong&gt; had measurably deeper beaks. &lt;strong&gt;Richard Lenski&amp;#039;s&lt;/strong&gt; bacteria experiment, started in 1988, has run for tens of thousands of generations.&lt;/p&gt;
&lt;p&gt;In the 1930s and 40s Fisher, Haldane, Wright and &lt;strong&gt;Theodosius Dobzhansky&lt;/strong&gt; joined evolution to genetics. Dobzhansky wrote in 1973 that &amp;quot;nothing in biology makes sense except in the light of evolution&amp;quot;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Made possible.&lt;/strong&gt; Tracking antibiotic resistance and the family tree of a virus, conservation genetics, and &lt;em&gt;directed evolution&lt;/em&gt;, in which enzymes are improved by mutation and selection in a test tube (Frances Arnold, Nobel Prize 2018). Evolution explains what happens once there is heredity. It does not by itself say how the first copying system arose; that is the subject of &lt;em&gt;Life&amp;#039;s origin: what we know and what we don&amp;#039;t&lt;/em&gt;. And it is the design process behind every example in &lt;em&gt;Nature as engineer: what nature teaches us&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;4-energy-conserved-and-always-degrading&quot;&gt;4. Energy: conserved, and always degrading&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The idea.&lt;/strong&gt; Energy changes form but its total never changes. In every process some of it becomes less useful: entropy does not decrease. Together these two laws forbid perpetual motion and put a hard ceiling on turning heat into work.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The evidence.&lt;/strong&gt; In 1775 the Paris Academy of Sciences decided to stop examining perpetual-motion machines, because none had ever worked. The measurements came in the 1840s. &lt;strong&gt;James Joule&lt;/strong&gt; let falling weights turn a paddle in water and measured a tiny rise in temperature, and found that the same work always gave the same heat, however it was done. (Water falling 100 m warms by only 0.23 degrees Celsius, so he needed extraordinary thermometers.) &lt;strong&gt;Mayer&lt;/strong&gt; and &lt;strong&gt;Helmholtz&lt;/strong&gt; made it a general law. &lt;strong&gt;Sadi Carnot&lt;/strong&gt; had already shown in 1824 that an engine&amp;#039;s best efficiency depends only on two temperatures, and &lt;strong&gt;Clausius&lt;/strong&gt; named entropy in 1865. &lt;strong&gt;Ludwig Boltzmann&lt;/strong&gt; then explained it by counting the arrangements of atoms, which welded idea 4 to idea 1.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  +-----------------------+
  | HOT: 500 C = 773 K    |
  +-----------------------+
              |  100 J of heat in
              v
  +-----------------------+
  | ENGINE (cycle)        |------&amp;gt; work out: 61 J at most
  +-----------------------+
              |  39 J of heat wasted
              v
  +-----------------------+
  | COLD: 30 C = 303 K    |
  +-----------------------+

First law: 100 J in = 61 J work + 39 J waste. Nothing is lost.
Second law: best work share = 1 - 303/773 = 0.61. No engine beats it.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Real coal plants reach about a third to 40%, and the best gas plants approach 60%. A beautiful footnote: &lt;strong&gt;Emmy Noether&lt;/strong&gt; proved in 1918 that energy conservation follows from the laws of physics not changing with time.&lt;/p&gt;
&lt;p&gt;Energy also played detective: using the new laws, Kelvin argued that the Sun was only tens of millions of years old, far too young for geology and Darwin. He was wrong only because fusion was still unknown.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Made possible.&lt;/strong&gt; Engines, power stations, refrigeration, and the chemistry of why reactions go.&lt;/p&gt;
&lt;h2 id=&quot;5-fields-relativity-and-quanta&quot;&gt;5. Fields, relativity and quanta&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The idea.&lt;/strong&gt; Space is not empty. It holds fields, electric, magnetic, gravitational and others, and light is a wave in them. Two further ideas sit on top. Relativity says space and time form one fabric that energy bends. Quantum theory says energy comes in packets and nature deals in probabilities. In modern physics the two merge: the world is made of quantum fields.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The evidence.&lt;/strong&gt; &lt;strong&gt;Michael Faraday&lt;/strong&gt; found in 1831 that a changing magnetic field drives a current, and imagined invisible lines of force. &lt;strong&gt;James Clerk Maxwell&lt;/strong&gt; wrote the equations in the 1860s and calculated the speed of their waves from electric and magnetic constants alone. It came out as the speed of light: light is an electromagnetic wave. &lt;strong&gt;Heinrich Hertz&lt;/strong&gt; made radio waves in 1887-88. &lt;strong&gt;Einstein&lt;/strong&gt; published special relativity in 1905, and E = mc^2 says that one gram of mass is about 9 x 10^13 joules, around 21 kilotons of TNT. In 1919 an eclipse expedition led by Arthur Eddington measured starlight bending near the Sun as his 1915 general relativity predicted, and in September 2015 the LIGO detectors heard gravitational waves from two black holes that merged about 1.3 billion years ago.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Max Planck&lt;/strong&gt; found in December 1900 that glowing bodies emit energy in packets. Einstein, Bohr, Heisenberg, Schrödinger and Dirac turned that into a theory that predicted antimatter (found in 1932). Its quantum-electrodynamics form predicts the electron&amp;#039;s magnetic moment to about one part in a trillion, among the best-tested predictions in science.&lt;/p&gt;
&lt;p&gt;You use relativity daily. A GPS satellite&amp;#039;s clock runs fast by about 45 microseconds a day because gravity is weaker up there, and slow by about 7 because it is moving: net +38. Left uncorrected, positions would drift by roughly 11 km a day (38 microseconds times the speed of light).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Made possible.&lt;/strong&gt; Electric power, radio, radar, the transistor (Bardeen, Brattain and Shockley, 1947) and so every computer, lasers, LEDs, MRI scanners and GPS.&lt;/p&gt;
&lt;h2 id=&quot;the-five-at-a-glance&quot;&gt;The five at a glance&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;+-----------+-------------------+-------------------+------------------+
| IDEA      | KEY EVIDENCE      | KEY PEOPLE        | MADE POSSIBLE    |
+-----------+-------------------+-------------------+------------------+
| ATOMS     | fixed ratios in   | Dalton,           | chemistry,       |
|           | compounds;        | Mendeleev,        | materials,       |
|           | jiggling pollen;  | Einstein, Perrin  | nuclear power    |
|           | periodic table    |                   |                  |
+-----------+-------------------+-------------------+------------------+
| CELLS &amp;amp;   | cells in every    | Hooke, Schwann,   | insulin from     |
| GENES     | tissue; 3:1 pea   | Mendel, Franklin, | bacteria, DNA    |
|           | ratios; DNA       | Watson, Crick     | tests, mRNA      |
|           | changes bacteria; |                   | vaccines         |
|           | X-ray images      |                   |                  |
+-----------+-------------------+-------------------+------------------+
| EVOLUTION | fossil sequence;  | Darwin, Wallace,  | tracking         |
|           | island species;   | Fisher,           | resistance and   |
|           | shared DNA; seen  | Dobzhansky        | viruses, enzyme  |
|           | in finches and    |                   | design           |
|           | bacteria          |                   |                  |
+-----------+-------------------+-------------------+------------------+
| ENERGY    | no perpetual      | Carnot, Joule,    | engines, power   |
|           | motion; heat and  | Mayer, Helmholtz, | plants,          |
|           | work trade at a   | Clausius          | refrigeration    |
|           | fixed rate        |                   |                  |
+-----------+-------------------+-------------------+------------------+
| FIELDS &amp;amp;  | light is a wave;  | Faraday, Maxwell, | radio,           |
| QUANTA    | bent starlight;   | Einstein, Planck, | transistors,     |
|           | atomic spectra;   | Bohr, Dirac       | lasers, MRI, GPS |
|           | GPS clocks        |                   |                  |
+-----------+-------------------+-------------------+------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;reading-them-together&quot;&gt;Reading them together&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;               1700     1750    1800     1850    1900     1950     2000
                 |        |       |        |       |        |        |
ATOMS     .........................a..........b......c...........d......
CELLS     .e.............................f....g..............h.......i..
EVOLUTION ..................................j.............k........l....
ENERGY    ............................m...n..o.p........................
FIELDS    .............................q.....r......s...t..............u
letters refer to the list below; 1 column = 5.8 years

a 1803 Dalton&amp;#039;s atomic theory       l 1988 Lenski E. coli experiment
b 1869 Mendeleev, periodic table    m 1824 Carnot&amp;#039;s engine limit
c 1908 Perrin settles atoms         n 1847 Helmholtz, conservation
d 1981 tunnelling microscope        o 1865 Clausius names entropy
e 1665 Hooke names cells            p 1877 Boltzmann, entropy counts
f 1839 Schwann, cell theory         q 1831 Faraday, induction
g 1866 Mendel&amp;#039;s pea laws            r 1865 Maxwell, light is a wave
h 1953 DNA double helix             s 1905 Einstein, relativity, photons
i 2003 human genome (2022 gapless)  t 1925 quantum mechanics
j 1859 Darwin&amp;#039;s Origin              u 2015 gravitational waves
k 1937 Dobzhansky, modern synthesis&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Three patterns stand out. Each idea needed an &lt;strong&gt;instrument or a measurement&lt;/strong&gt; before it won: Joule&amp;#039;s thermometer, Perrin&amp;#039;s microscope, Eddington&amp;#039;s eclipse plates. They &lt;strong&gt;fuse in pairs&lt;/strong&gt;: atoms plus energy is statistical mechanics, atoms plus quanta is chemistry, genes plus evolution is the modern synthesis, genes plus atoms is molecular biology. And acceptance was never one experiment. It came when independent lines of evidence, such as fossils and DNA, pointed the same way.&lt;/p&gt;
&lt;p&gt;Other ideas could sit on this list: germ theory, plate tectonics, the expanding universe and computation each have a case. If you want to argue with my five, good. Arguing from evidence is the habit they all have in common.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Philosophy for people who read machine code</title>
    <link>https://ozdc.us/p/philosophy-for-people-who-read-machine-code/</link>
    <guid isPermaLink="true">https://ozdc.us/p/philosophy-for-people-who-read-machine-code/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Mon, 02 Mar 2026 00:00:00 +0000</pubDate>
    <category>philosophy</category>
    <category>essay</category>
    <category>reverse-engineering</category>
    <description>&lt;p&gt;The last four posts were about money, banks, the world order and the spirit of the age. This one closes the series by going back to the oldest tools for thinking. People who reverse engineer software meet these questions every day without naming them. Here are some of them, with names.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;              .-&amp;quot;&amp;quot;&amp;quot;&amp;quot;&amp;quot;&amp;quot;-.
            .&amp;#039;          &amp;#039;.              &amp;quot;The unexamined binary
           /   O      O   \              is not worth running.&amp;quot;
          :                :
          |      .--.      |                     — not Socrates
          :     (    )     :
           \     &amp;#039;--&amp;#039;     /
            &amp;#039;.          .&amp;#039;
              &amp;#039;-......-&amp;#039;
          ___/  |    |  \___
         /      |____|      \&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;1-plato-s-cave-you-only-ever-see-the-shadows&quot;&gt;1. Plato&amp;#039;s cave: you only ever see the shadows&lt;/h2&gt;
&lt;p&gt;In Plato&amp;#039;s &lt;em&gt;Republic&lt;/em&gt;, prisoners are chained in a cave facing a wall. Behind them a fire throws the shadows of objects onto that wall. Having seen nothing else, the prisoners take the shadows for reality. Philosophy, for Plato, is the painful climb out to see the things themselves.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;        outside: the sun, the real things
   ______________________________________________________
   |  fire   |  objects carried past:  [#]  [^]  [o]     |
   |   )\    |                                           |
   |  (  )   |   o   o   o   o   o    &amp;lt;- prisoners,      |
   |   &amp;#039;&amp;#039;    |   |   |   |   |   |       chained, facing |
   |_________|______________________________ the wall __|
                                    WALL:  ~#~   ~^~   ~o~
                                    &amp;quot;this is reality&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A disassembler is a cave with good lighting. You never see the programmer&amp;#039;s intent or the original source. You see a projection: bytes, decoded into instructions, rendered by a tool that makes its own guesses. &lt;strong&gt;Decompiler output is a shadow of a shadow.&lt;/strong&gt; The discipline of the craft is the same as Plato&amp;#039;s: never mistake the representation for the thing, and keep asking what produced it.&lt;/p&gt;
&lt;h2 id=&quot;2-the-ship-of-theseus-is-it-still-the-same-program&quot;&gt;2. The ship of Theseus: is it still the same program?&lt;/h2&gt;
&lt;p&gt;The Greeks told of the ship of the hero Theseus, kept in Athens as a memorial. As planks rotted they were replaced, until no original plank remained. Is it the same ship? Thomas Hobbes added a twist: what if someone collected the old planks and rebuilt a ship from them? Which one is Theseus&amp;#039;s ship?&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   v1.0   [####][####][####][####]
   v1.1   [####][####][::::][####]     one function patched
   v2.0   [::::][####][::::][::::]     most code rewritten
   v3.0   [::::][::::][::::][::::]     nothing original left
          ^ same name, same version history, same users... same program?&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Software makes this concrete. Every release replaces planks. A binary diff tool answers the question in one way (changed bytes), a user in another (same name, same purpose), a lawyer in a third (who owns which part). The lesson is that &lt;strong&gt;identity is not a property you can read from the bytes alone&lt;/strong&gt;. It depends on which criterion you choose, and you should say which one you are using.&lt;/p&gt;
&lt;h2 id=&quot;3-descartes-demon-and-trusting-trust&quot;&gt;3. Descartes&amp;#039; demon and trusting trust&lt;/h2&gt;
&lt;p&gt;René Descartes asked what he could know for certain if a powerful demon were deceiving all his senses. He stripped away everything doubtable and found one thing left: the fact that he was thinking. &lt;em&gt;Cogito, ergo sum&lt;/em&gt;: I think, therefore I am.&lt;/p&gt;
&lt;p&gt;In 1984 Ken Thompson gave a Turing Award lecture called &lt;em&gt;Reflections on Trusting Trust&lt;/em&gt; that is Descartes&amp;#039; demon in a compiler. He described a compiler that inserts a hidden behaviour into programs it compiles, and also re-inserts that trick whenever it compiles a new version of itself. The source code of both would look clean. His conclusion: you can&amp;#039;t fully trust code you did not totally create yourself, and that includes your tools.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   source (looks clean) --&amp;gt; [ compiler ] --&amp;gt; binary (not clean)
                                 ^
                                 |  who compiled the compiler?
                           [ compiler&amp;#039; ] &amp;lt;-- who compiled that one?  ...&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Descartes escaped the demon by trusting a good God. Engineers escape it, partly, with methods: reproducible builds, compiling the compiler through independent toolchains, auditing the hardware. Neither escape is a proof. Both are reasonable bets. &lt;strong&gt;All knowledge rests somewhere on trust; the craft is choosing where.&lt;/strong&gt;&lt;/p&gt;
&lt;h2 id=&quot;4-the-chinese-room-does-the-machine-understand&quot;&gt;4. The Chinese room: does the machine understand?&lt;/h2&gt;
&lt;p&gt;John Searle&amp;#039;s 1980 thought experiment: a man who knows no Chinese sits in a room with a huge rulebook. Chinese questions come in through a slot. He matches the symbols to the rules and passes back the indicated symbols, which turn out to be fluent answers. To the people outside, the room understands Chinese. Searle says no one inside does. Following rules for symbols (&lt;strong&gt;syntax&lt;/strong&gt;) is not the same as understanding them (&lt;strong&gt;semantics&lt;/strong&gt;).&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;            +----------------------------------------------+
  &amp;quot;%#&amp;amp; @?&amp;quot;  |  [man]  + [ RULEBOOK: if %#&amp;amp; @? -&amp;gt; &amp;amp;&amp;amp;% !# ]  |  &amp;quot;&amp;amp;&amp;amp;% !#&amp;quot;
  ---------&amp;gt;|   ._.                                        |----------&amp;gt;
            |   /|\     &amp;quot;I have no idea what this means&amp;quot;   |
            +----------------------------------------------+
            (the squiggles stand for Chinese characters)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every CPU is a Chinese room. It fetches, decodes and executes with no idea what the program is &amp;quot;about&amp;quot;. When we reverse engineer, we supply the semantics: this loop is a checksum, this struct is a network packet. The meaning is in our heads, not in the silicon. With today&amp;#039;s language models, Searle&amp;#039;s question is no longer academic. Some reply that understanding belongs to the &lt;em&gt;whole system&lt;/em&gt;, not to the man. Others agree with Searle that symbol manipulation, however good, isn&amp;#039;t understanding. The debate is open.&lt;/p&gt;
&lt;h2 id=&quot;5-social-facts-what-money-really-is&quot;&gt;5. Social facts: what money really is&lt;/h2&gt;
&lt;p&gt;This brings the series back to its start. Searle also wrote about &lt;strong&gt;social reality&lt;/strong&gt;. Some facts exist only because we collectively accept them, in the form &lt;em&gt;&amp;quot;X counts as Y in context C&amp;quot;&lt;/em&gt;:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;        X                  counts as    Y                    in context C
  a piece of paper     ------------&amp;gt;  a 100-euro note        the euro area
  a number in a DB     ------------&amp;gt;  a bank deposit         banking law
  a line of hex        ------------&amp;gt;  a valid signature      this public key
  a person             ------------&amp;gt;  president              a constitution&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Money, borders, companies, marriages and passwords are all real, with huge effects. Yet none would exist if everyone stopped accepting them. That is why &lt;em&gt;What money is&lt;/em&gt; ended on trust as the one field you can&amp;#039;t write directly. A monetary order, a world order, even a Zeitgeist is a vast structure of &amp;quot;counts-as&amp;quot; agreements. They are sturdy as long as most people go along with them, and surprisingly fragile when they stop.&lt;/p&gt;
&lt;h2 id=&quot;6-a-short-toolkit&quot;&gt;6. A short toolkit&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  +-----------------+--------------------------------------------+
  | Ockham&amp;#039;s razor  | prefer the explanation with fewer moving   |
  |                 | parts (usually a bug, not a plot)          |
  |                 |                                            |
  | Socratic method | ask &amp;quot;what do you mean by that?&amp;quot; until      |
  |                 | the definition breaks                      |
  |                 |                                            |
  | Popper          | a claim no test could refute tells you     |
  |                 | little; try to break your own idea first   |
  |                 |                                            |
  | Hume            | &amp;quot;it worked every time so far&amp;quot; does not     |
  |                 | prove it will work next time               |
  |                 |                                            |
  | Wittgenstein    | meaning is use: judge a value by how it    |
  |                 | is used, not by what it is called          |
  +-----------------+--------------------------------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each of these is also a habit of good analysis. The razor kills conspiracy theories and over-engineered hypotheses about a binary alike. Popper&amp;#039;s test is the difference between a hunch and a finding. Wittgenstein&amp;#039;s advice is literally how you name variables in a decompiler: by how they are used.&lt;/p&gt;
&lt;h2 id=&quot;closing&quot;&gt;Closing&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;      .----------------------------------------------.
      |                                              |
      |   bytes  -&amp;gt;  instructions  -&amp;gt;  intent        |
      |   paper  -&amp;gt;  promises      -&amp;gt;  money         |
      |   events -&amp;gt;  patterns      -&amp;gt;  an age        |
      |                                              |
      |   in every case the last step is ours.       |
      |                                              |
      &amp;#039;----------------------------------------------&amp;#039;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Reverse engineering, economics and philosophy share one move: start from raw material that does not explain itself, and reconstruct the structure that gives it meaning. The best practitioners in all three stay humble about the last step, because that is where we add ourselves.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Ghidra: the first hour with a new binary</title>
    <link>https://ozdc.us/p/ghidra-the-first-hour/</link>
    <guid isPermaLink="true">https://ozdc.us/p/ghidra-the-first-hour/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sat, 24 Jan 2026 00:00:00 +0000</pubDate>
    <category>ghidra</category>
    <category>tooling</category>
    <category>tutorial</category>
    <description>&lt;p&gt;Ghidra is free, open source, and has a good decompiler. Opening a binary for the first time can still be overwhelming: thousands of functions named &lt;code&gt;FUN_00401136&lt;/code&gt;, and decompiler output full of &lt;code&gt;param_1&lt;/code&gt; and &lt;code&gt;local_18&lt;/code&gt;. This is the routine I follow in the first hour. Practise it on programs you compiled yourself, where you can check your guesses against the source.&lt;/p&gt;
&lt;h2 id=&quot;1-project-and-import&quot;&gt;1. Project and import&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;File → New Project&lt;/em&gt; (non-shared), then &lt;em&gt;File → Import File&lt;/em&gt; and pick the binary. Ghidra detects the format (ELF, PE, Mach-O, raw) and the architecture. Look at the import summary: it repeats what &lt;code&gt;file&lt;/code&gt; and &lt;code&gt;readelf -h&lt;/code&gt; would tell you.&lt;/p&gt;
&lt;p&gt;Double-click the file to open it in the &lt;strong&gt;CodeBrowser&lt;/strong&gt; and accept auto-analysis with the default options. For a small program it takes seconds.&lt;/p&gt;
&lt;h2 id=&quot;2-get-oriented&quot;&gt;2. Get oriented&lt;/h2&gt;
&lt;p&gt;Four windows do most of the work:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Symbol Tree&lt;/strong&gt; (left): functions, imports, exports, labels&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Listing&lt;/strong&gt; (centre): the disassembly&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Decompiler&lt;/strong&gt; (right): C-like pseudocode for the current function&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Defined Strings&lt;/strong&gt; (&lt;em&gt;Window → Defined Strings&lt;/em&gt;): every string Ghidra found&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Start with the &lt;strong&gt;imports&lt;/strong&gt; (Symbol Tree → Imports). They tell you what the program can do: file access, networking, process creation, cryptography. Then skim &lt;strong&gt;Defined Strings&lt;/strong&gt;: messages, paths and format strings often point straight at the interesting functions.&lt;/p&gt;
&lt;h2 id=&quot;3-find-your-way-in&quot;&gt;3. Find your way in&lt;/h2&gt;
&lt;p&gt;Three good starting points:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;The entry point&lt;/strong&gt; → &lt;code&gt;__libc_start_main&lt;/code&gt; → its first argument is &lt;code&gt;main&lt;/code&gt; (on Linux). Ghidra usually names it for you if symbols exist.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Cross-references from a string&lt;/strong&gt;: in Defined Strings, double-click a string, then right-click its label → &lt;em&gt;References → Show References to&lt;/em&gt; (Ctrl+Shift+F). That lists the code that uses it.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Cross-references from an import&lt;/strong&gt;: same thing on, say, &lt;code&gt;fopen&lt;/code&gt;, to find every place that opens a file.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;4-make-the-decompiler-readable&quot;&gt;4. Make the decompiler readable&lt;/h2&gt;
&lt;p&gt;This is where the time goes, and it compounds: every name you add makes every other function easier to read.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Rename&lt;/strong&gt; a function or variable: click it, press &lt;strong&gt;L&lt;/strong&gt;. Name what you&amp;#039;re sure of; use a prefix like &lt;code&gt;maybe_&lt;/code&gt; for guesses.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Retype&lt;/strong&gt; a variable: &lt;strong&gt;Ctrl+L&lt;/strong&gt;. Changing &lt;code&gt;undefined8&lt;/code&gt; to &lt;code&gt;char *&lt;/code&gt; or to a struct pointer often transforms a whole function.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Fix a function signature&lt;/strong&gt;: right-click the function name in the decompiler → &lt;em&gt;Edit Function Signature&lt;/em&gt;. Correct argument types propagate to every caller.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Comment&lt;/strong&gt;: &lt;strong&gt;;&lt;/strong&gt; in the Listing adds a comment at the current line. Write down why you believe something, not just what.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Create a struct&lt;/strong&gt; from a pointer: right-click the variable → &lt;em&gt;Auto Create Structure&lt;/em&gt;, then rename the fields (see &amp;quot;Structs in disassembly&amp;quot;).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Go to&lt;/strong&gt; an address or name: &lt;strong&gt;G&lt;/strong&gt;.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Work outward from what you understand: leaf functions (ones that call nothing) are usually small and easiest to name, and their names make their callers readable.&lt;/p&gt;
&lt;h2 id=&quot;5-don-t-trust-the-decompiler-blindly&quot;&gt;5. Don&amp;#039;t trust the decompiler blindly&lt;/h2&gt;
&lt;p&gt;Decompiled code is a reconstruction. Check the Listing when:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;types look wrong (a pointer shown as a &lt;code&gt;long&lt;/code&gt;, odd casts everywhere)&lt;/li&gt;&lt;li&gt;a function seems to take the wrong number of arguments: fix the signature&lt;/li&gt;&lt;li&gt;there are &lt;code&gt;switch&lt;/code&gt; statements or jump tables that weren&amp;#039;t recovered&lt;/li&gt;&lt;li&gt;the code uses tricks the decompiler simplifies away&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Clicking a line in the Decompiler highlights the matching instructions in the Listing, and the other way round. Use that constantly.&lt;/p&gt;
&lt;h2 id=&quot;6-save-your-work&quot;&gt;6. Save your work&lt;/h2&gt;
&lt;p&gt;Ghidra saves everything in the project: names, types, comments. &lt;em&gt;File → Save&lt;/em&gt; often. For notes that outlive the project, keep a plain text file next to it: the hash of the binary, what you&amp;#039;ve confirmed, open questions, and the addresses of the important functions.&lt;/p&gt;
&lt;h2 id=&quot;practice&quot;&gt;Practice&lt;/h2&gt;
&lt;p&gt;Compile one of the small programs from the earlier posts (the &lt;code&gt;sum&lt;/code&gt; loop, the &lt;code&gt;switch&lt;/code&gt; example, the &lt;code&gt;struct packet&lt;/code&gt; functions), strip it with &lt;code&gt;strip&lt;/code&gt;, and load it in Ghidra. Rename everything back to the original names using only what you can see. Then compare with the source: where you were wrong teaches you the most.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Zeitgeist: reading the spirit of an age</title>
    <link>https://ozdc.us/p/zeitgeist/</link>
    <guid isPermaLink="true">https://ozdc.us/p/zeitgeist/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Thu, 20 Nov 2025 00:00:00 +0000</pubDate>
    <category>philosophy</category>
    <category>history</category>
    <category>society</category>
    <category>essay</category>
    <description>&lt;p&gt;The previous three posts were about money: &lt;em&gt;What money is&lt;/em&gt;, &lt;em&gt;How banks create money&lt;/em&gt; and &lt;em&gt;The world monetary order, from gold to the dollar&lt;/em&gt;. Money is never only technical. Each monetary order reflects what its age believed about trust, the state and the future. This post steps back to that larger idea: the &lt;strong&gt;spirit of an age&lt;/strong&gt;.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;            .     *        .        .   *       .        *
       *        .     _______________________      .
     .      .        /                       \  *       .
        *           /   Z  E  I  T  G  E  I  S  T  \      .
     .        .    /___________________________\     *
          *          |  |  |  |  |  |  |  |  |  |   .
     .        *      |  the  air  everyone  |  |        *
        .            |  breathes  and  no   |  |   .
     *       .       |  one  can  see       |  |      .
                  ___|__|__|__|__|__|__|__|__|__|___
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-word&quot;&gt;The word&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Zeitgeist&lt;/em&gt; is German: &lt;em&gt;Zeit&lt;/em&gt; (time) + &lt;em&gt;Geist&lt;/em&gt; (spirit, mind). The idea is usually traced to &lt;strong&gt;Johann Gottfried Herder&lt;/strong&gt; in the late 18th century, who argued that each people and each era has its own way of feeling and thinking, and should be judged by its own standards, not by ours.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;G. W. F. Hegel&lt;/strong&gt; gave the idea its weight. For Hegel, history is the story of &lt;em&gt;Geist&lt;/em&gt;, of mind slowly coming to understand itself and its freedom. Every age expresses one stage of that process in its law, art, religion and philosophy. Two of his lines are often quoted in paraphrase:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Philosophy is &lt;strong&gt;its own time grasped in thought&lt;/strong&gt;. No thinker can leap over their era any more than a person can jump over their own shadow.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The owl of Minerva flies only at dusk&lt;/strong&gt;: we understand an age properly only when it is ending.&lt;/li&gt;&lt;/ul&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   an age is lived ---------------------------&amp;gt; and then understood
   [ dawn ] ........ [ noon ] ........ [ dusk ]
                                          ,___,
                                          (O,O)   &amp;lt;- Minerva&amp;#039;s owl
                                          /)  )      sets out only now
                                         --&amp;quot;-&amp;quot;--&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That second line is a warning for anyone, me included, who tries to name &lt;em&gt;our&lt;/em&gt; spirit while still inside it.&lt;/p&gt;
&lt;h2 id=&quot;is-there-really-one-spirit&quot;&gt;Is there really one spirit?&lt;/h2&gt;
&lt;p&gt;Critics have pushed back hard on the idea.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Karl Marx&lt;/strong&gt; turned Hegel upside down: ideas don&amp;#039;t drive history, material life does. The &amp;quot;spirit of an age&amp;quot; mostly reflects how it produces things and who owns what.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Karl Popper&lt;/strong&gt; distrusted any theory that claims to know where history must go. He thought such theories feed authoritarian politics.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Historians&lt;/strong&gt; point out that every age is plural. Peasants and courtiers, women and men, colonisers and colonised did not share one spirit.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;A careful use of the word keeps all three objections in mind. A Zeitgeist is a &lt;strong&gt;pattern of shared assumptions&lt;/strong&gt;: what an era takes for granted, finds obvious, or cannot imagine. It is not a ghost directing events.&lt;/p&gt;
&lt;h2 id=&quot;about-the-2007-film&quot;&gt;About the 2007 film&lt;/h2&gt;
&lt;p&gt;Many people meet the word through &lt;em&gt;Zeitgeist&lt;/em&gt;, an online film from 2007 and its sequels. Since this series is about money, it is worth being direct about it. The film&amp;#039;s central claims are:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;the US Federal Reserve is a private plot to enslave the public through debt;&lt;/li&gt;&lt;li&gt;the 9/11 attacks were an inside job;&lt;/li&gt;&lt;li&gt;Christianity was copied wholesale from ancient sun myths.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;All three are rejected by the historians, economists and investigators who have examined them. The film does touch real questions, such as how banks create money and who benefits from monetary policy. But it answers them with conspiracy rather than evidence. &lt;em&gt;How banks create money&lt;/em&gt; covers the actual mechanics, which are both less sinister and more interesting. The later films moved toward a technocratic utopia (the &amp;quot;resource-based economy&amp;quot; of the Venus Project), which is a separate and openly debated set of ideas.&lt;/p&gt;
&lt;h2 id=&quot;ages-in-one-picture&quot;&gt;Ages in one picture&lt;/h2&gt;
&lt;p&gt;Simplifying a lot, here is how the spirit of a few eras is often summarised, set beside its money:&lt;/p&gt;
&lt;div class=&quot;tbl-wrap&quot;&gt;&lt;table class=&quot;mdtbl&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Era&lt;/th&gt;&lt;th&gt;What it took for granted&lt;/th&gt;&lt;th&gt;Its money&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;19th-c. liberal age&lt;/td&gt;&lt;td&gt;progress, empire, the gold-backed promise&lt;/td&gt;&lt;td&gt;gold standard, sterling&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1914-1945&lt;/td&gt;&lt;td&gt;crisis of liberalism, mass politics, total war&lt;/td&gt;&lt;td&gt;broken gold, controls&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1945-1971&lt;/td&gt;&lt;td&gt;planning, welfare states, reconstruction&lt;/td&gt;&lt;td&gt;Bretton Woods&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;1980-2008&lt;/td&gt;&lt;td&gt;markets, globalisation, &amp;quot;end of history&amp;quot;&lt;/td&gt;&lt;td&gt;floating rates, dollar system&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;after 2008&lt;/td&gt;&lt;td&gt;crises, networks, distrust of institutions&lt;/td&gt;&lt;td&gt;QE, crypto, sanctions&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;h2 id=&quot;trying-to-read-our-own-age&quot;&gt;Trying to read our own age&lt;/h2&gt;
&lt;p&gt;With the owl&amp;#039;s warning in mind, here are some descriptions that serious thinkers have offered of the present. Each catches something, and each is disputed.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                       +------------------+
                       |  NETWORKED SELF   |  feeds, profiles, metrics
                       +---------+--------+
                                 |
  +---------------+     +--------v--------+     +-------------------+
  | ACCELERATION  |----&amp;gt;|   O U R   A G E  |&amp;lt;----|  DISTRUST OF THE  |
  | more, faster  |     |       (?)        |     |  INSTITUTIONS     |
  +---------------+     +--------+--------+     +-------------------+
                                 |
                       +---------v--------+
                       |   POLYCRISIS     |  climate, war, money, health
                       +------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Acceleration.&lt;/strong&gt; The sociologist &lt;strong&gt;Hartmut Rosa&lt;/strong&gt; argues that modern life is defined by speeding up: of technology, of social change, of the pace of living. We gain options but lose a stable connection to the world. He calls that missing connection &lt;em&gt;resonance&lt;/em&gt;.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The attention economy.&lt;/strong&gt; When information is abundant, attention becomes scarce. Platforms compete for it, and what spreads is what provokes. Critics link this to polarisation. Others note that moral panics followed the novel, the radio and television too.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Distrust.&lt;/strong&gt; Trust in governments, media and experts has fallen in many countries. One reading: elites failed (2008, wars, inequality) and people noticed. Another: networks make every failure visible and every rumour viral, so trust erodes even when performance doesn&amp;#039;t.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Polycrisis.&lt;/strong&gt; The historian &lt;strong&gt;Adam Tooze&lt;/strong&gt; popularised this word for the feeling that crises in climate, energy, money, health and geopolitics now feed each other, so no single one can be solved alone.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The optimists&amp;#039; reply.&lt;/strong&gt; Writers like &lt;strong&gt;Steven Pinker&lt;/strong&gt; and &lt;strong&gt;Hans Rosling&lt;/strong&gt; point to long-run data: extreme poverty, child mortality and illiteracy have fallen dramatically. On this view our age is a period of real progress, experienced through a news cycle that only reports bad things.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Notice that each description also implies a politics. That is the risk with the word. Whoever names the spirit of the age is often trying to recruit it.&lt;/p&gt;
&lt;h2 id=&quot;a-practical-exercise&quot;&gt;A practical exercise&lt;/h2&gt;
&lt;p&gt;You can&amp;#039;t see the air you breathe, but you can test for it. Three questions help:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;What do people around me find obvious that past generations would find strange?&lt;/strong&gt; (Carrying a networked computer at all times; money as numbers on a screen.)&lt;/li&gt;&lt;li&gt;&lt;strong&gt;What would people in fifty years find strange about us?&lt;/strong&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Who benefits from things staying obvious?&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   assumption ----&amp;gt; test it ----&amp;gt; still holds?  --yes--&amp;gt; keep it, for now
                                     |
                                     no
                                     v
                          you just saw a piece of the Zeitgeist&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next and last in this series: &lt;em&gt;Philosophy for people who read machine code&lt;/em&gt;, about old questions that look surprisingly fresh to anyone who spends their days in a disassembler.&lt;/p&gt;</description>
  </item>
  <item>
    <title>How we know the universe is expanding</title>
    <link>https://ozdc.us/p/how-we-know-the-universe-is-expanding/</link>
    <guid isPermaLink="true">https://ozdc.us/p/how-we-know-the-universe-is-expanding/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Tue, 21 Oct 2025 00:00:00 +0000</pubDate>
    <category>science</category>
    <category>astronomy</category>
    <category>cosmology</category>
    <description>&lt;p&gt;Nobody has read the source code of the universe. All we have is output: light arriving at telescopes. Cosmology is a long exercise in reverse engineering that output. If the light looks like this, what must the machine behind it be doing? The claim that the universe is expanding sounds like a wild guess, but it rests on independent lines of evidence. This post follows them in the order they were found, and ends with a number that two good methods still disagree on.&lt;/p&gt;
&lt;h2 id=&quot;light-as-a-barcode&quot;&gt;Light as a barcode&lt;/h2&gt;
&lt;p&gt;Every chemical element absorbs and emits light at its own exact wavelengths, a fingerprint that physicists mapped in the 19th century by studying sunlight and flames. If a distant galaxy shows the familiar pattern of calcium, hydrogen, magnesium and sodium lines but everything sits at slightly longer wavelengths, its light has been stretched. The fractional stretch is the &lt;strong&gt;redshift&lt;/strong&gt; z: z equals (observed wavelength minus emitted wavelength) divided by emitted wavelength.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;nm           400      500      600      700      800      900     1000
         -----+--------+--------+--------+--------+--------+--------+---
visible     ##################################
z=0.0    ....|.......|..|......|.....|..................................
z=0.05   ......|........|..|.....|......|...............................
z=0.1    ........|........|..|......|......|............................
z=0.5    ......................|...........|....|.........|........|....

| = dark absorption line: Ca (H+K), H-beta, Mg, Na, H-alpha, left to
right. The pattern is the same; the whole thing slides to the red.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From 1912 Vesto Slipher at Lowell Observatory measured these shifts for the &amp;quot;spiral nebulae&amp;quot; and found that nearly all of them were redshifted. The missing ingredient was distance. In 1912 Henrietta Leavitt had found that a class of pulsating stars, the Cepheids, pulse more slowly the brighter they truly are. Compare true brightness with apparent brightness and you have a distance. In 1923 to 1924 Edwin Hubble found Cepheids in the Andromeda &amp;quot;nebula&amp;quot; and showed it lies far outside our Milky Way: it is another galaxy.&lt;/p&gt;
&lt;p&gt;In 1927 the Belgian priest and physicist Georges Lemaitre showed that Einstein&amp;#039;s equations allow an expanding universe and, from the data then available, estimated the rate. In 1929 Hubble published his own plot: the farther the galaxy, the faster it recedes.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;km/s    |                                                          o.
        |                                                    ooo.o. o
        |   speed = H0 x distance                        .o.oo
10,000  |   H0 ~ 70 km/s per Mpc                  o .o... o
        |   (schematic data)                   o....
        |                                 ..ooooo
        |                            ....oo o
        |                    o  ..oo.  o
 5,000  |                  .oo..o
        |             ..oo.
        |        ...o.
        |   oooo.
  0     |...
        +------------------------------------------------------------&amp;gt;
         0             50             100            150            200
         distance in megaparsecs (1 Mpc = 3.26 million light-years)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The straight line is the &lt;strong&gt;Hubble-Lemaitre law&lt;/strong&gt;, v = H0 x d (the IAU recommended that name in 2018). Hubble&amp;#039;s first value for H0 was about 500 km/s per Mpc, roughly seven times too high; today it is near 70. The error mattered: 1/H0 is a rough age, and 500 gives only 2 billion years, younger than rocks on Earth. Fixing the distances cured the problem.&lt;/p&gt;
&lt;h2 id=&quot;stretching-space-not-an-explosion&quot;&gt;Stretching space, not an explosion&lt;/h2&gt;
&lt;p&gt;The standard picture is not of galaxies flying outward through space, but of space itself stretching. A redshift of z means that the universe has grown by a factor of 1 + z since the light left.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;then            A---B---C---D---E
later (x2)      A-------B-------C-------D-------E

seen from A         B   C   D   E
distance then       4   8  12  16
distance later      8  16  24  32
moved away          4   8  12  16   &amp;lt;- speed grows with distance&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Think of raisins in rising dough. Every gap doubles, so raisin E moves four times as far as raisin B. Seen from &lt;em&gt;any&lt;/em&gt; raisin, the others recede at speeds proportional to distance, so Hubble&amp;#039;s law needs no centre. Blow up a balloon with dots on it and you get the same thing:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                                              .........o..
                                           ....          ....
          .                              ..o                ...
     ........o...                      ...                    ...
   ..o          ...                   ..                        ..
  ..              .o                  .                          o
  .                .                  .                          .
  .                ..    inflate      .                          ..
  o                .      -----&amp;gt;      o                          .
  ..              ..                  .                          .
   ...          ...                   ..                        ..
     .o........o.                      ...                    ...
          .                              ...                ...
                                           .o..          .o..
                                              ............

    then                                later: every dot-to-dot gap grew&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both pictures have limits, and the limits matter:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;The balloon&amp;#039;s &lt;em&gt;surface&lt;/em&gt; is the universe. Its inside and its outside are not places, so there is no centre to point at.&lt;/li&gt;&lt;li&gt;Raisins do not grow, and neither do atoms, planets, or galaxies. Bound objects stay bound; Andromeda is moving &lt;em&gt;toward&lt;/em&gt; us at about 110 km/s.&lt;/li&gt;&lt;li&gt;Bread has an edge. The universe may be infinite and needs nothing to expand into.&lt;/li&gt;&lt;li&gt;Beyond roughly 14 billion light-years the recession speed exceeds that of light. That is allowed, because it is stretching of space, not motion through it.&lt;/li&gt;&lt;li&gt;The Big Bang was not an explosion at one point. It happened everywhere at once.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;the-distance-ladder&quot;&gt;The distance ladder&lt;/h2&gt;
&lt;p&gt;No single method measures distances all the way out, so astronomers stack them, each rung calibrating the next:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                                            +--------------------------+
                                            | 4 Hubble flow            |
                                            | billions of ly           |
                                  +---------+                          |
                                  | 3 Type Ia supernovae               |
                                  | to ~10 billion ly                  |
                        +---------+                                    |
                        | 2 Cepheids, red giants                       |
                        | to ~100 million ly                           |
              +---------+                                              |
              | 1 Parallax (Gaia)                                      |
              | thousands of ly                                        |
    +---------+                                                        |
    | 0 Radar, Kepler&amp;#039;s laws                                           |
    | the Solar System                                                 |
    +------------------------------------------------------------------+&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Parallax is plain triangulation (Friedrich Bessel did the first in 1838), and the Gaia satellite has measured it for well over a billion stars. Cepheids reach other galaxies. &lt;strong&gt;Type Ia supernovae&lt;/strong&gt;, exploding white dwarfs that all peak at nearly the same brightness once corrected for how fast they fade, are visible across billions of light-years. The catch is that errors accumulate from rung to rung. Hold that thought.&lt;/p&gt;
&lt;h2 id=&quot;the-afterglow&quot;&gt;The afterglow&lt;/h2&gt;
&lt;p&gt;In 1948 Ralph Alpher and Robert Herman predicted that a hot early universe should leave a faint cool afterglow, about 5 K. In 1964 two radio engineers, Arno Penzias and Robert Wilson, were testing a horn antenna at Bell Labs in New Jersey and found a stubborn hiss of microwave noise coming equally from every direction. They checked the equipment, even cleaned out pigeon droppings, and the hiss stayed. Not far away, at Princeton, a group around Robert Dicke was building a detector to look for exactly this. Back-to-back papers appeared in 1965, and Penzias and Wilson received the 1978 Nobel Prize in Physics.&lt;/p&gt;
&lt;p&gt;This &lt;strong&gt;cosmic microwave background&lt;/strong&gt; (CMB) is light released about 380,000 years after the Big Bang, when the universe cooled to about 3,000 K and electrons and protons first combined into atoms, so light could travel freely. Since then space has stretched by a factor of about 1,100, so that glow now arrives as 2.725 K microwaves. About 1 percent of the &amp;quot;snow&amp;quot; on an old analogue TV tuned between channels is this ancient light.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;      |             #######
      |           ##:::::::##                   T = 2.725 K
      |         ##:::::::::::###                peak near 160 GHz
      |        #::::::::::::::::##              (perfect blackbody)
      |       #:::::::::::::::::::###
      |      #:::::::::::::::::::::::##
      |     #::::::::::::::::::::::::::###
      |    #::::::::::::::::::::::::::::::###
      |   #::::::::::::::::::::::::::::::::::#####
      |  #::::::::::::::::::::::::::::::::::::::::##########
      |##:::::::::::::::::::::::::::::::::::::::::::::::::::#######
      +------------------------------------------------------------&amp;gt;
       0        100       200       300       400       500       600
       frequency in GHz (microwaves)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In 1990 the COBE satellite showed that the spectrum is a blackbody to extraordinary precision (Nobel Prize 2006, John Mather and George Smoot). Later missions, WMAP and Planck, mapped temperature differences of one part in 100,000, the seeds of galaxies. A third independent check is the recipe for light elements: a hot early universe predicts about 75 percent hydrogen and 25 percent helium by mass, which is what the oldest gas clouds contain.&lt;/p&gt;
&lt;h2 id=&quot;the-timeline&quot;&gt;The timeline&lt;/h2&gt;
&lt;p&gt;Putting these together gives the standard timeline. (The name &amp;quot;Big Bang&amp;quot; came from Fred Hoyle, who favoured a rival theory, in a BBC radio talk in 1949.)&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;t = 0        o  our equations stop working here; &amp;quot;zero&amp;quot; is not described
             |
~1e-36 s     o  inflation (a hypothesis): huge, very fast stretching
             |
~1e-5 s      o  quarks bind into protons and neutrons (1e12 K)
             |
1 s to 3 min o  light nuclei form: ~75% hydrogen, ~25% helium by mass
             |
380,000 yr   o  atoms form, light is freed: the CMB (3,000 K)
             |
0.1-0.3 Gyr  o  first stars and galaxies (JWST sees back to here)
             |
~7.7 Gyr     o  expansion turns from slowing to speeding up
             |
9.2 Gyr      o  the Sun and Earth form (4.6 billion years ago)
             |
13.8 Gyr     *  today: the CMB has cooled to 2.7 K

Gyr = billion years after the Big Bang. Times are rounded, and the
earliest entries are well tested only from about 1 second onward.&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;1998-the-expansion-is-speeding-up&quot;&gt;1998: the expansion is speeding up&lt;/h2&gt;
&lt;p&gt;In the 1990s two teams, led by Saul Perlmutter and by Brian Schmidt and Adam Riess, used distant Type Ia supernovae to measure how much the expansion had slowed down, as gravity should do. They found the opposite: the supernovae were fainter, so farther away, than a slowing universe predicts. The expansion is accelerating. (Nobel Prize 2011.) The cause is called &lt;strong&gt;dark energy&lt;/strong&gt;. The simplest candidate is a cosmological constant, a constant energy of empty space that Einstein once introduced and then dismissed. In the standard model dark energy makes up about 68 percent of today&amp;#039;s energy budget, dark matter 27 percent and ordinary matter 5 percent. We do not know what it is.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;size  |
      |
      |                                                           ***
      |                                                        ***
      |                                                    ****
      |                                                 ***
      |                                            *****
      |                                       *****          ........
      |                                 ****** ..............
      |                          *******.......
  1   |                ..********.
      |        .*********
      | .*******               ^ now
      |**
      +--------------------------------------------------------------&amp;gt;
       0                10               20                30
       time since the Big Bang, billion years

* with dark energy (the simplest model): bends upward, about 6 billion
  years ago, as dark energy took over   . gravity alone: ever slower&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Recent surveys, notably DESI in 2024 and 2025, hint that dark energy might change over time. The statistical evidence is intriguing but not decisive.&lt;/p&gt;
&lt;h2 id=&quot;an-open-question-the-hubble-tension&quot;&gt;An open question: the Hubble tension&lt;/h2&gt;
&lt;p&gt;Two good ways of measuring H0 disagree. The distance ladder (the SH0ES team) gives about 73 km/s per Mpc, with an uncertainty near 1. Inferring H0 from the CMB with the standard model (Planck satellite) gives about 67.4, with an uncertainty near 0.5. That is an 8 percent gap, at the level of five standard deviations. Newer JWST observations of the Cepheids support the ladder&amp;#039;s number, while another team using different stars gets about 70, in between.&lt;/p&gt;
&lt;p&gt;Either an error lurks somewhere in a long chain of calibrations, or the standard model of cosmology is missing something. Nobody knows yet, and the numbers shift with each new paper, so treat these as the state of play in 2025.&lt;/p&gt;
&lt;p&gt;Try the arithmetic yourself. The Coma galaxy cluster has z = 0.0231 and lies roughly 100 Mpc (320 million light-years) away:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;python&quot;&gt;&lt;code&gt;c = 299_792.458            # km/s
z = 0.0231                 # redshift of the Coma cluster
d = 100                    # Mpc, about 320 million light-years

v = c * z                  # fine for small z
print(f&amp;quot;v  = {v:,.0f} km/s&amp;quot;)
print(f&amp;quot;H0 = {v/d:.0f} km/s per Mpc&amp;quot;)
print(f&amp;quot;1/H0 = {3.0857e19 / (v/d) / 3.156e7 / 1e9:.1f} billion years&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;v  = 6,925 km/s
H0 = 69 km/s per Mpc
1/H0 = 14.1 billion years&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That is 69, between the two camps, and 1/H0 comes out near 14 billion years, close to the true age of 13.8. One cluster settles nothing, though: its own motion and its distance are uncertain, which is why the real work uses thousands of objects. Cosmic expansion rests on the same general relativity as &lt;em&gt;Black holes, simply&lt;/em&gt;, and the Doppler idea behind redshift also finds planets, as in &lt;em&gt;Exoplanets: how we find other worlds&lt;/em&gt;. For the local scale this all sits on, see &lt;em&gt;A tour of the solar system&lt;/em&gt;.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Parsing binary formats with Python&#039;s struct</title>
    <link>https://ozdc.us/p/parsing-binary-formats-with-python/</link>
    <guid isPermaLink="true">https://ozdc.us/p/parsing-binary-formats-with-python/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sun, 12 Oct 2025 00:00:00 +0000</pubDate>
    <category>python</category>
    <category>file-formats</category>
    <category>tooling</category>
    <category>tutorial</category>
    <description>&lt;p&gt;Decoding a header by hand is the best way to learn a format. Doing it a second time is a waste: write a parser. Python&amp;#039;s &lt;code&gt;struct&lt;/code&gt; module, in the standard library, turns bytes into numbers with a short format string, and it&amp;#039;s enough for most formats you&amp;#039;ll meet.&lt;/p&gt;
&lt;h2 id=&quot;the-format-string&quot;&gt;The format string&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;struct.unpack(fmt, data)&lt;/code&gt; reads bytes according to &lt;code&gt;fmt&lt;/code&gt; and returns a tuple. The first character sets the byte order:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;&amp;lt;&lt;/code&gt; little-endian (ELF on x86, PE, most in-memory data)&lt;/li&gt;&lt;li&gt;&lt;code&gt;&amp;gt;&lt;/code&gt; big-endian (PNG, JPEG, network protocols)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Then one letter per field:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;B  unsigned char   1      b  signed char    1
H  unsigned short  2      h  short          2
I  unsigned int    4      i  int            4
Q  unsigned 8-byte 8      q  signed 8-byte  8
s  bytes, e.g. 4s = 4 raw bytes             x  one padding byte&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With &lt;code&gt;&amp;lt;&lt;/code&gt; or &lt;code&gt;&amp;gt;&lt;/code&gt;, no automatic padding is added: the format describes the bytes exactly.&lt;/p&gt;
&lt;h2 id=&quot;example-1-the-elf-header&quot;&gt;Example 1: the ELF header&lt;/h2&gt;
&lt;p&gt;In &amp;quot;The ELF header, byte by byte&amp;quot; we decoded &lt;code&gt;/bin/ls&lt;/code&gt; by hand. The same thing in Python:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;python&quot;&gt;&lt;code&gt;import struct

FIELDS = (&amp;quot;type machine version entry phoff shoff flags &amp;quot;
          &amp;quot;ehsize phentsize phnum shentsize shnum shstrndx&amp;quot;).split()

def elf_header(path):
    with open(path, &amp;quot;rb&amp;quot;) as f:
        data = f.read(64)
    if data[:4] != b&amp;quot;\x7fELF&amp;quot;:
        raise ValueError(&amp;quot;not an ELF file&amp;quot;)
    if data[4] != 2 or data[5] != 1:
        raise ValueError(&amp;quot;only 64-bit little-endian here&amp;quot;)
    values = struct.unpack_from(&amp;quot;&amp;lt;HHIQQQIHHHHHH&amp;quot;, data, 16)
    return dict(zip(FIELDS, values))

for k, v in elf_header(&amp;quot;/bin/ls&amp;quot;).items():
    print(f&amp;quot;{k:10} {v:#x}&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;unpack_from&lt;/code&gt; reads at an offset (16, right after &lt;code&gt;e_ident&lt;/code&gt;) without slicing. The format &lt;code&gt;&amp;lt;HHIQQQIHHHHHH&lt;/code&gt; is just the field sizes in order: 2, 2, 4, 8, 8, 8, 4, then six 2-byte fields. On Ubuntu 24.04 it prints &lt;code&gt;type 0x3&lt;/code&gt;, &lt;code&gt;machine 0x3e&lt;/code&gt;, &lt;code&gt;entry 0x6d30&lt;/code&gt;: the same values &lt;code&gt;readelf -h&lt;/code&gt; shows.&lt;/p&gt;
&lt;h2 id=&quot;example-2-walking-png-chunks&quot;&gt;Example 2: walking PNG chunks&lt;/h2&gt;
&lt;p&gt;From &amp;quot;Reading a PNG by hand&amp;quot;: a chunk is a big-endian length, a 4-byte type, the data, and a CRC.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;python&quot;&gt;&lt;code&gt;import struct, zlib

def png_chunks(path):
    data = open(path, &amp;quot;rb&amp;quot;).read()
    if data[:8] != b&amp;quot;\x89PNG\r\n\x1a\n&amp;quot;:
        raise ValueError(&amp;quot;not a PNG&amp;quot;)
    pos = 8
    while pos &amp;lt; len(data):
        length, ctype = struct.unpack_from(&amp;quot;&amp;gt;I4s&amp;quot;, data, pos)
        body = data[pos + 8 : pos + 8 + length]
        (crc,) = struct.unpack_from(&amp;quot;&amp;gt;I&amp;quot;, data, pos + 8 + length)
        ok = crc == zlib.crc32(ctype + body)
        yield pos, ctype.decode(&amp;quot;ascii&amp;quot;, &amp;quot;replace&amp;quot;), length, ok
        pos += 12 + length

for off, name, size, ok in png_chunks(&amp;quot;tiny.png&amp;quot;):
    print(f&amp;quot;{off:#06x}  {name}  {size:5}  crc {&amp;#039;ok&amp;#039; if ok else &amp;#039;BAD&amp;#039;}&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;0x0008  IHDR     13  crc ok
0x0021  IDAT     22  crc ok
0x0043  IEND      0  crc ok&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A few lines, and you have a validator that also tells you about extra data after &lt;code&gt;IEND&lt;/code&gt; or chunks with bad CRCs: exactly the things you look for when a file seems &amp;quot;off&amp;quot;.&lt;/p&gt;
&lt;h2 id=&quot;habits-that-keep-parsers-honest&quot;&gt;Habits that keep parsers honest&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Check magic numbers first&lt;/strong&gt; and fail with a clear message.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Bounds-check&lt;/strong&gt; every length before you use it: &lt;code&gt;if pos + 12 + length &amp;gt; len(data): raise ...&lt;/code&gt;. Real files are truncated or deliberately malformed, and a parser for untrusted input must not trust the lengths inside it.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Print offsets&lt;/strong&gt; in hex next to every value. You&amp;#039;ll compare against a hexdump constantly.&lt;/li&gt;&lt;li&gt;For bigger formats, &lt;code&gt;struct.Struct(&amp;quot;&amp;lt;HHI&amp;quot;)&lt;/code&gt; compiles the format once and gives you &lt;code&gt;.size&lt;/code&gt; for free, and &lt;code&gt;ctypes.Structure&lt;/code&gt; or a library like &lt;code&gt;construct&lt;/code&gt; let you describe the layout declaratively.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;when-to-stop-and-use-a-library&quot;&gt;When to stop and use a library&lt;/h2&gt;
&lt;p&gt;For ELF and PE, &lt;code&gt;pyelftools&lt;/code&gt; and &lt;code&gt;pefile&lt;/code&gt; already handle every edge case; for anything you&amp;#039;re learning, writing the first version yourself is how the format sticks.&lt;/p&gt;</description>
  </item>
  <item>
    <title>The world monetary order, from gold to the dollar</title>
    <link>https://ozdc.us/p/the-world-monetary-order/</link>
    <guid isPermaLink="true">https://ozdc.us/p/the-world-monetary-order/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sun, 24 Aug 2025 00:00:00 +0000</pubDate>
    <category>economics</category>
    <category>history</category>
    <category>money</category>
    <category>geopolitics</category>
    <category>essay</category>
    <description>&lt;p&gt;&lt;em&gt;What money is&lt;/em&gt; and &lt;em&gt;How banks create money&lt;/em&gt; looked inside one country. But a Brazilian firm buying German machines with a loan priced in dollars uses three moneys at once. This post follows the wiring between them: the international monetary order, and how it has been rebuilt roughly once a lifetime.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                          .-~~~~~~~~~-.
                      .-~   $    ¥    ~-.
                    .&amp;#039;   €    ____   £   &amp;#039;.
                   /      .-~~    ~~-.     \
                  | CHF  /   W O R L D \ INR|
                  |     |   L E D G E R |   |
                   \     \    ~~~~    /    /
                    &amp;#039;.    &amp;#039;-.______.-&amp;#039;   .&amp;#039;
                      &amp;#039;-.  RUB  BRL  .-&amp;#039;
                          &amp;#039;-~~~~~~~-&amp;#039;
                 many currencies, one question:
             &amp;quot;what do we settle in when we disagree?&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;era-1-the-classical-gold-standard-about-1870-1914&quot;&gt;Era 1: the classical gold standard (about 1870-1914)&lt;/h2&gt;
&lt;p&gt;Major currencies were defined as a weight of gold. A pound sterling was a fixed amount of gold, and so was a dollar, so their exchange rate was fixed too. London was the financial centre, and sterling bills were the way world trade was paid.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Strength:&lt;/strong&gt; stable exchange rates and long-run price stability. Trade and investment flowed across borders.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Weakness:&lt;/strong&gt; a country losing gold had to shrink its money supply, which meant falling wages and rising unemployment, with little room to respond. The system worked while governments were able, or willing, to impose that pain.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The First World War broke it. Countries printed money to fight. Attempts to restore gold in the 1920s, with the wrong exchange rates and little cooperation, helped spread the Great Depression. Countries that left gold earliest tended to recover earliest.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  1870 ====== GOLD STANDARD ====== 1914 ~~ war ~~ 1925 = gold again =
                                       1929-1936 xx collapse xx
                                        \__ the Depression spreads __/&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;era-2-bretton-woods-1944-1971&quot;&gt;Era 2: Bretton Woods (1944-1971)&lt;/h2&gt;
&lt;p&gt;In July 1944, delegates from 44 Allied nations met at Bretton Woods, New Hampshire, to design a system that would avoid the 1930s. John Maynard Keynes (UK) and Harry Dexter White (US) led the design. The result:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                    +------------------+
                    |   GOLD  $35/oz   |  convertible only for
                    +--------+---------+  foreign central banks
                             |
                    +--------v---------+
                    |    US DOLLAR     |  the anchor
                    +--------+---------+
            fixed but adjustable rates (pegs)
       +-----------+---------+---------+-----------+
       |           |                   |           |
    [ DM ]      [ FF ]              [ £ ]       [ ¥ ]   ...

     watched over by the IMF; rebuilding funded by the World Bank&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;Other currencies were pegged to the dollar, and the dollar to gold at &lt;strong&gt;$35 an ounce&lt;/strong&gt;.&lt;/li&gt;&lt;li&gt;The &lt;strong&gt;IMF&lt;/strong&gt; lent to countries with temporary payment problems. The &lt;strong&gt;World Bank&lt;/strong&gt; (originally for reconstruction) financed development.&lt;/li&gt;&lt;li&gt;Capital movements were widely controlled, so countries could set their own interest rates.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The design had a built-in tension, later named the &lt;strong&gt;Triffin dilemma&lt;/strong&gt;. The world needed more dollars as trade grew, which meant the US had to run deficits. But the more dollars piled up abroad, the less believable it became that each one could be turned into gold. By the late 1960s foreign dollar holdings far exceeded US gold reserves.&lt;/p&gt;
&lt;h2 id=&quot;the-break-15-august-1971&quot;&gt;The break: 15 August 1971&lt;/h2&gt;
&lt;p&gt;On 15 August 1971 President Nixon announced that the US would stop converting dollars into gold for foreign governments, &amp;quot;temporarily&amp;quot;. It was never restored. After a short attempt to fix new rates (the Smithsonian Agreement), the major currencies were &lt;strong&gt;floating&lt;/strong&gt; by 1973.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  before 1971:   $ ---&amp;gt; Au    a dollar is a claim on gold
  after  1971:   $ ---&amp;gt; $     a dollar is a claim on the US economy,
                              its laws and its markets&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;era-3-floating-rates-and-the-dollar-system-1973-today&quot;&gt;Era 3: floating rates and the dollar system (1973-today)&lt;/h2&gt;
&lt;p&gt;What came next was less a designed system than a set of habits that hardened. Exchange rates are mostly set by markets, though many countries still manage or peg their currency. And the dollar stayed at the centre, in some ways more than before.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Oil and commodities&lt;/strong&gt; are mostly priced and paid in dollars. The &amp;quot;petrodollar&amp;quot; arrangements with Gulf producers in the 1970s helped, and petrodollars were recycled into US assets.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Reserves:&lt;/strong&gt; central banks hold foreign currency to defend their own. According to IMF COFER data, the dollar&amp;#039;s share of identified reserves fell from about 70% around 2000 to roughly &lt;strong&gt;56-58% in 2025-26&lt;/strong&gt;. That is still more than twice the euro.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Trading:&lt;/strong&gt; in the BIS survey of April 2025, the dollar was on one side of &lt;strong&gt;about 89% of all foreign-exchange trades&lt;/strong&gt;, out of a daily turnover of roughly $9.6 trillion.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Debt:&lt;/strong&gt; a large share of cross-border loans and bonds is in dollars, so a stronger dollar squeezes borrowers worldwide.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The French minister Valéry Giscard d&amp;#039;Estaing called this the dollar&amp;#039;s &lt;strong&gt;&amp;quot;exorbitant privilege&amp;quot;&lt;/strong&gt;: the US can borrow cheaply in its own currency, and the world absorbs its deficits. The other side is an obligation. When markets panic, the world runs &lt;em&gt;to&lt;/em&gt; the dollar, and the US Federal Reserve has repeatedly acted as a global lender of last resort through &lt;strong&gt;swap lines&lt;/strong&gt; with other central banks (2008, 2020).&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   a crisis anywhere --&amp;gt; everyone wants dollars --&amp;gt; dollar rises
          |                                            |
          v                                            v
   dollar debts get heavier               Fed swap lines calm the panic&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-plumbing-messages-clearing-and-sanctions&quot;&gt;The plumbing: messages, clearing and sanctions&lt;/h2&gt;
&lt;p&gt;Money moves between countries through correspondent banks. Banks hold accounts at each other and send payment instructions, most of them over &lt;strong&gt;SWIFT&lt;/strong&gt;, a Belgian cooperative messaging network. SWIFT does not move money itself. It carries the messages that tell banks to debit and credit.&lt;/p&gt;
&lt;p&gt;Because so much of the world settles in dollars through US banks, access to this plumbing became a tool of foreign policy. Russia&amp;#039;s partial exclusion from SWIFT and the freezing of its central-bank reserves in 2022 were a turning point. Some countries began asking whether their reserves were truly theirs.&lt;/p&gt;
&lt;h2 id=&quot;the-current-debate-multipolar-money&quot;&gt;The current debate: multipolar money?&lt;/h2&gt;
&lt;p&gt;This is where reasonable people disagree most. The positions, as their defenders would put them:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;quot;De-dollarisation is under way.&amp;quot;&lt;/strong&gt; Central banks have bought gold at record pace since 2022. China built its own payment network (CIPS) and settles more trade in renminbi. BRICS members discuss settling trade in local currencies. Sanctions have taught the world to diversify, and the US debt burden will slowly erode trust.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;quot;The dollar is still the only real option.&amp;quot;&lt;/strong&gt; A reserve currency needs deep, open, liquid bond markets, free movement of capital, and courts that investors trust. The euro has no single safe bond. The renminbi is held back by capital controls. Gold pays no interest and can&amp;#039;t be used for most payments. On the numbers, the dollar&amp;#039;s share of trading and debt has barely moved.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;quot;A slow drift, not a switch.&amp;quot;&lt;/strong&gt; Many economists expect a gradual shift: a slowly shrinking dollar share, more regional currencies, more gold, and new digital payment rails, with the dollar still first for decades. Sterling&amp;#039;s handover to the dollar took roughly from the 1910s to the 1950s.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  1870 ------ 1914 ---- 1944 -------- 1971 -------- 2008 ---- 2022 --- ?
  £ + gold    war       $ + gold      $ floats      crisis    sanctions
  [classical] [chaos]   [Bretton W.]  [dollar system]         [multipolar?]&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;Every world monetary order answers the same three questions:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;What is the anchor?&lt;/strong&gt; Gold, a dominant currency, or nothing.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Who adjusts when imbalances build up?&lt;/strong&gt; The deficit country, the surplus country, or the market.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Who stands behind the system in a panic?&lt;/strong&gt; Someone has to be the lender of last resort.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Since 1971 the answers have been the dollar, mostly the market, and the US Federal Reserve. Whether those answers hold in the coming decades is one of the defining questions of our time. That is also where the next post starts: &lt;em&gt;Zeitgeist: reading the spirit of an age&lt;/em&gt;.&lt;/p&gt;</description>
  </item>
  <item>
    <title>Reading a PNG by hand</title>
    <link>https://ozdc.us/p/reading-a-png-by-hand/</link>
    <guid isPermaLink="true">https://ozdc.us/p/reading-a-png-by-hand/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sat, 05 Jul 2025 00:00:00 +0000</pubDate>
    <category>file-formats</category>
    <category>hex</category>
    <category>tutorial</category>
    <description>&lt;p&gt;File formats are where hexdump skills pay off outside of executables. PNG is a perfect first format: simple, well documented, and big-endian, which makes a nice contrast with the little-endian ELF header.&lt;/p&gt;
&lt;h2 id=&quot;the-file&quot;&gt;The file&lt;/h2&gt;
&lt;p&gt;A 2×2 yellow image, 79 bytes in total:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;hexdump&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;00000000&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;89&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;50&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;4e&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;47&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;0d&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;0a&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;1a&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;0a&lt;/span&gt;  &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;0d&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;49&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;48&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;44&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;52&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|.PNG........IHDR|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000010&lt;/span&gt;  &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;08&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;fd&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;d4&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;9a&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|................|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000020&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;73&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;16&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;49&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;44&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;41&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;54&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;78&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;9c&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;63&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;fc&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;ff&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;9f&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|s....IDATx.c....|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000030&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;89&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;81&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;01&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;19&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;11&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;02&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;9d&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|................|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00000040&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;ce&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;17&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;c3&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;49&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;45&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;4e&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;44&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;ae&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;60&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;82&lt;/span&gt;     &lt;span class=&quot;st&quot;&gt;|.......IEND.B`.|&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-signature-8-bytes&quot;&gt;The signature: 8 bytes&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;89 50 4e 47 0d 0a 1a 0a&lt;/code&gt;. Every byte has a job:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;89&lt;/code&gt;: a non-ASCII byte, so tools that only handle 7-bit text notice corruption&lt;/li&gt;&lt;li&gt;&lt;code&gt;50 4e 47&lt;/code&gt;: &lt;code&gt;PNG&lt;/code&gt;, readable in a hexdump&lt;/li&gt;&lt;li&gt;&lt;code&gt;0d 0a&lt;/code&gt;: a Windows line ending, and later &lt;code&gt;0a&lt;/code&gt; a Unix one: a transfer that converts line endings breaks the signature, so the damage is detected immediately&lt;/li&gt;&lt;li&gt;&lt;code&gt;1a&lt;/code&gt;: Ctrl-Z, which stops the &lt;code&gt;type&lt;/code&gt; command on old DOS systems from printing binary garbage&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;It&amp;#039;s a nice example of a format designed to fail loudly.&lt;/p&gt;
&lt;h2 id=&quot;chunks&quot;&gt;Chunks&lt;/h2&gt;
&lt;p&gt;After the signature, the file is a list of &lt;strong&gt;chunks&lt;/strong&gt;, each with the same layout:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;4 bytes   length of the data (big-endian)
4 bytes   type, four ASCII letters
n bytes   data
4 bytes   CRC-32 of type + data (big-endian)&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;ihdr-at-0x08&quot;&gt;IHDR at 0x08&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;length &lt;code&gt;00 00 00 0d&lt;/code&gt; = 13. Big-endian: read the bytes in order, no reversing.&lt;/li&gt;&lt;li&gt;type &lt;code&gt;49 48 44 52&lt;/code&gt; = &lt;code&gt;IHDR&lt;/code&gt;&lt;/li&gt;&lt;li&gt;data, 13 bytes:&lt;/li&gt;&lt;li&gt;width &lt;code&gt;00 00 00 02&lt;/code&gt; = 2&lt;/li&gt;&lt;li&gt;height &lt;code&gt;00 00 00 02&lt;/code&gt; = 2&lt;/li&gt;&lt;li&gt;bit depth &lt;code&gt;08&lt;/code&gt;&lt;/li&gt;&lt;li&gt;colour type &lt;code&gt;02&lt;/code&gt; = RGB, no alpha&lt;/li&gt;&lt;li&gt;compression &lt;code&gt;00&lt;/code&gt;, filter &lt;code&gt;00&lt;/code&gt;, interlace &lt;code&gt;00&lt;/code&gt;&lt;/li&gt;&lt;li&gt;CRC &lt;code&gt;fd d4 9a 73&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3 id=&quot;idat-at-0x21&quot;&gt;IDAT at 0x21&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;length &lt;code&gt;00 00 00 16&lt;/code&gt; = 22&lt;/li&gt;&lt;li&gt;type &lt;code&gt;IDAT&lt;/code&gt;: the image data&lt;/li&gt;&lt;li&gt;data starts with &lt;code&gt;78 9c&lt;/code&gt;: a zlib header. The pixels are compressed with DEFLATE, so you can&amp;#039;t read them directly here, but &lt;code&gt;78 9c&lt;/code&gt; is a pattern worth recognising: you&amp;#039;ll find zlib streams inside many formats.&lt;/li&gt;&lt;li&gt;CRC &lt;code&gt;9d ce 17 c3&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h3 id=&quot;iend-at-0x43&quot;&gt;IEND at 0x43&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;length 0, type &lt;code&gt;IEND&lt;/code&gt;, CRC &lt;code&gt;ae 42 60 82&lt;/code&gt;. Every PNG ends with exactly these 12 bytes: &lt;code&gt;00 00 00 00 49 45 4e 44 ae 42 60 82&lt;/code&gt;. Handy when you need to find where an image ends inside a bigger file.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;check-the-crc-yourself&quot;&gt;Check the CRC yourself&lt;/h2&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;python3 -c &amp;quot;import zlib; print(hex(zlib.crc32(bytes.fromhex(&amp;#039;49484452000000020000000208020000 00&amp;#039;.replace(&amp;#039; &amp;#039;,&amp;#039;&amp;#039;)))))&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It prints &lt;code&gt;0xfdd49a73&lt;/code&gt;, the same as in the file: CRC-32 over the type and data, not the length.&lt;/p&gt;
&lt;h2 id=&quot;decompress-the-pixels&quot;&gt;Decompress the pixels&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;python&quot;&gt;&lt;code&gt;import zlib
data = open(&amp;#039;tiny.png&amp;#039;, &amp;#039;rb&amp;#039;).read()
raw = zlib.decompress(data[0x29:0x29 + 22])
print(raw.hex(&amp;#039; &amp;#039;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;01 ff ff 00 00 00 00 02 00 00 00 00 00 00&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Two rows of 7 bytes: a &lt;strong&gt;filter byte&lt;/strong&gt;, then 2 pixels × 3 bytes. The encoder filtered each row to make it compress better:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;row 1, filter &lt;code&gt;01&lt;/code&gt; (Sub): each byte is stored as the difference from the byte one pixel to the left. The first pixel is &lt;code&gt;ff ff 00&lt;/code&gt; (yellow); the second is stored as &lt;code&gt;00 00 00&lt;/code&gt;, meaning &amp;quot;same as the previous pixel&amp;quot;.&lt;/li&gt;&lt;li&gt;row 2, filter &lt;code&gt;02&lt;/code&gt; (Up): each byte is the difference from the pixel above, so an identical row is all zeros.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Undo the filters and you get four &lt;code&gt;ff ff 00&lt;/code&gt; pixels: a 2×2 yellow square. Filters are why PNG data compresses well, and why you can&amp;#039;t read pixels straight out of a decompressed stream without applying them.&lt;/p&gt;
&lt;h2 id=&quot;lessons-that-carry-over&quot;&gt;Lessons that carry over&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Check the byte order in the spec before reading any number: PNG, JPEG and network protocols are big-endian; ELF on x86, PE and most in-memory structures are little-endian.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Length + type + data&lt;/strong&gt; is one of the most common file structures you&amp;#039;ll meet (RIFF, PNG, many game and firmware formats). Once you spot it, you can walk the file even without a spec.&lt;/li&gt;&lt;li&gt;Data that looks random usually is compressed or encrypted. Look for known headers like &lt;code&gt;78 9c&lt;/code&gt; (zlib) or &lt;code&gt;1f 8b&lt;/code&gt; (gzip) at its start.&lt;/li&gt;&lt;/ul&gt;</description>
  </item>
  <item>
    <title>How banks create money</title>
    <link>https://ozdc.us/p/how-banks-create-money/</link>
    <guid isPermaLink="true">https://ozdc.us/p/how-banks-create-money/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Fri, 16 May 2025 00:00:00 +0000</pubDate>
    <category>economics</category>
    <category>banking</category>
    <category>money</category>
    <category>essay</category>
    <description>&lt;p&gt;In &lt;em&gt;What money is&lt;/em&gt; we saw that most money is not cash but numbers in bank databases. This post follows those numbers: who writes them, under what rules, and what stops them from growing without limit.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                     _______________________________
                    /                               \
                   /   B A N K   O F   L E D G E R   \
                  /_________________________________ _\
                   |  ||  ||  ||  ||  ||  ||  ||  ||  |
                   |  ||  ||  ||  ||  ||  ||  ||  ||  |
                   |  ||  ||  ||  ||  ||  ||  ||  ||  |
                   |  ||  ||  ||  ||  ||  ||  ||  ||  |
                  _|__||__||__||__||__||__||__||__||__|_
                 |______________________________________|
                       debit  |  credit   (balance: ?)&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;the-textbook-story-and-why-it-is-misleading&quot;&gt;The textbook story, and why it is misleading&lt;/h2&gt;
&lt;p&gt;Many of us learned the &lt;strong&gt;money multiplier&lt;/strong&gt;: you deposit 100, the bank keeps 10 as a reserve and lends out 90, the 90 gets deposited elsewhere, that bank lends 81, and so on. Banks are pictured as middlemen that pass savers&amp;#039; money on to borrowers.&lt;/p&gt;
&lt;p&gt;In 2014 the Bank of England published a paper, &lt;em&gt;Money creation in the modern economy&lt;/em&gt;, that said plainly this is not how it works today. The order is reversed: &lt;strong&gt;when a bank makes a loan, it creates a new deposit at the same moment&lt;/strong&gt;. Lending comes first; the deposit is the result.&lt;/p&gt;
&lt;h2 id=&quot;a-loan-step-by-step&quot;&gt;A loan, step by step&lt;/h2&gt;
&lt;p&gt;Look at the bank&amp;#039;s balance sheet. Assets on the left, liabilities on the right. Everything must balance.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  BEFORE the loan
  +------------------------+------------------------+
  | ASSETS                 | LIABILITIES            |
  +------------------------+------------------------+
  | reserves       1,000   | deposits       9,000   |
  | other loans    9,000   | equity         1,000   |
  +------------------------+------------------------+
    total     10,000           total   10,000

                      |  the bank types two numbers
                      v

  AFTER a 10,000 loan to Anna
  +------------------------+------------------------+
  | ASSETS                 | LIABILITIES            |
  +------------------------+------------------------+
  | reserves       1,000   | deposits       9,000   |
  | other loans    9,000   | Anna deposit  10,000 * |
  | Anna&amp;#039;s loan   10,000 * | equity         1,000   |
  +------------------------+------------------------+
    total     20,000           total   20,000
    * new: an asset (her debt) and a liability (her money)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The bank did not take 10,000 from anyone. It typed two numbers:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;an &lt;strong&gt;asset&lt;/strong&gt;: Anna owes the bank 10,000 (plus interest);&lt;/li&gt;&lt;li&gt;a &lt;strong&gt;liability&lt;/strong&gt;: the bank owes Anna a 10,000 deposit she can spend.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;That new deposit is money: she can pay a builder with it. Broad money in the economy grew by 10,000. When Anna repays the loan, the reverse happens and the money is destroyed. The money supply is a constant flow of creation (new loans) and destruction (repayments).&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;     new loan                 spending                  repayment
   +---------+   deposit   +-----------+   deposit   +------------+
   |  bank   | ----------&amp;gt; |   Anna    | ----------&amp;gt; |  builder   |
   | creates |   +10,000   | pays bill |   moves     |  ...       |
   +---------+             +-----------+             +------------+
        ^                                                   |
        |__________ loan repaid: deposit and loan vanish ___|&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;so-what-stops-banks-from-printing-forever&quot;&gt;So what stops banks from printing forever?&lt;/h2&gt;
&lt;p&gt;If loans make money, why don&amp;#039;t banks lend without limit? Because several brakes act on them, and these are the real limits:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Profitability and risk.&lt;/strong&gt; A loan that isn&amp;#039;t repaid is a loss that eats the bank&amp;#039;s &lt;strong&gt;equity&lt;/strong&gt;. Banks lend when they expect to be repaid with interest.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Demand.&lt;/strong&gt; Someone must want to borrow at the offered rate. In a recession, demand for loans falls even if banks want to lend.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Capital rules.&lt;/strong&gt; International rules (the &lt;strong&gt;Basel&lt;/strong&gt; accords) require equity of at least a certain share of risky assets. Less capital means less lending.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Liquidity rules.&lt;/strong&gt; When Anna pays a builder at &lt;em&gt;another&lt;/em&gt; bank, her bank must transfer real &lt;strong&gt;reserves&lt;/strong&gt; to that bank. A bank must hold enough liquid assets to survive outflows.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The price of money.&lt;/strong&gt; The central bank sets the short-term interest rate, which ripples out to every loan rate. Higher rates mean fewer profitable loans and fewer willing borrowers.&lt;/li&gt;&lt;/ol&gt;
&lt;h2 id=&quot;two-kinds-of-money-two-layers-of-banks&quot;&gt;Two kinds of money, two layers of banks&lt;/h2&gt;
&lt;p&gt;The system has two layers, and each has its own money:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;                    +-------------------------------+
                    |         CENTRAL BANK          |
                    |  issues: cash + RESERVES      |
                    |  sets:   policy interest rate |
                    +---------------+---------------+
                                    |  reserves move only between banks
              +---------------------+---------------------+
              |                     |                     |
        +-----v-----+         +-----v-----+         +-----v-----+
        |  Bank A   | &amp;lt;-----&amp;gt; |  Bank B   | &amp;lt;-----&amp;gt; |  Bank C   |
        | DEPOSITS  | payments| DEPOSITS  |         | DEPOSITS  |
        +-----+-----+  settle +-----+-----+         +-----+-----+
              |       in reserves   |                     |
        households &amp;amp; firms hold DEPOSITS (bank money), not reserves&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Reserves&lt;/strong&gt; are money that only banks hold, in accounts at the central bank. Payments between banks finally settle in reserves.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Deposits&lt;/strong&gt; are what you and I hold: promises by a commercial bank to pay us central-bank money (cash or a transfer).&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Your deposit is therefore a promise layered on another promise. Most of the time nobody notices the difference, because deposits are insured (up to a limit) and convertible one-to-one.&lt;/p&gt;
&lt;h2 id=&quot;when-the-promise-wobbles-bank-runs&quot;&gt;When the promise wobbles: bank runs&lt;/h2&gt;
&lt;p&gt;A bank keeps only a fraction of its deposits as cash and reserves. That&amp;#039;s fine as long as only a few depositors want their money on the same day. If many come at once, even a healthy bank can&amp;#039;t pay them all, because its assets are long loans that can&amp;#039;t be sold quickly. That is a &lt;strong&gt;bank run&lt;/strong&gt;.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   day 1:  [$][$][$][$][$]  ... calm, a few withdrawals
   day 2:  rumour -&amp;gt;  ( !! )
   day 3:  o o o o o o o o o o o o o o o o o o o   &amp;lt;- the queue
           |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
           &amp;quot;first come, first served&amp;quot; makes waiting irrational&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Modern runs happen in hours, through phones. Silicon Valley Bank in March 2023 lost about $42 billion in deposits in a single day. Societies have built three defences:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Deposit insurance&lt;/strong&gt;, so small savers have no reason to run.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The central bank as lender of last resort&lt;/strong&gt;, lending reserves against good collateral to a bank that is solvent but short of cash.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Supervision and capital rules&lt;/strong&gt;, so banks are less likely to be insolvent in the first place.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Critics point out a cost. If the downside is insured and bailouts are likely, banks may take more risk. That problem is called &lt;strong&gt;moral hazard&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;what-the-central-bank-actually-does&quot;&gt;What the central bank actually does&lt;/h2&gt;
&lt;p&gt;Before 2008 central banks mainly steered one interest rate by adjusting the amount of reserves. After the 2008 crisis and again in 2020 they also bought large amounts of government and other bonds, paying with new reserves. This is &lt;strong&gt;quantitative easing (QE)&lt;/strong&gt;. It pushed long-term interest rates down and filled banks with reserves. Many countries, including the US since March 2020, now have no reserve requirement at all; rates are steered by the interest the central bank pays on reserves.&lt;/p&gt;
&lt;p&gt;Views on QE divide sharply:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Supporters&lt;/strong&gt; say it prevented a depression.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Critics&lt;/strong&gt; say it inflated asset prices, helping those who already owned stocks and houses, and blurred the line between monetary policy and financing the state.&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;debates-worth-knowing&quot;&gt;Debates worth knowing&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Full-reserve or &amp;quot;sovereign money&amp;quot; proposals&lt;/strong&gt; (Switzerland voted on one in 2018 and rejected it) would stop commercial banks from creating money. Only the central bank would create it.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Central bank digital currencies (CBDCs)&lt;/strong&gt; would let the public hold central-bank money directly. People argue over privacy, over whether deposits would drain out of banks, and over how much the state could see.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Stablecoins and crypto&lt;/strong&gt; try to build a parallel ledger. They meet the same questions as banks: what backs the promise, and who covers a run?&lt;/li&gt;&lt;/ul&gt;
&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  loan --&amp;gt; deposit (new money) --&amp;gt; spending --&amp;gt; repayment --&amp;gt; destroyed
            ^
            limited by: profit, demand, capital, liquidity, rates&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Commercial banks create most of the money we use, by lending. Central banks don&amp;#039;t control the quantity directly. They control its price and the plumbing, and they stand behind the system when it panics. Next: how these national systems connect into one world monetary order.&lt;/p&gt;</description>
  </item>
  <item>
    <title>How a call to puts reaches libc (PLT and GOT)</title>
    <link>https://ozdc.us/p/how-a-call-to-puts-reaches-libc/</link>
    <guid isPermaLink="true">https://ozdc.us/p/how-a-call-to-puts-reaches-libc/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sat, 19 Apr 2025 00:00:00 +0000</pubDate>
    <category>elf</category>
    <category>linux</category>
    <category>dynamic-linking</category>
    <category>tutorial</category>
    <description>&lt;p&gt;A dynamically linked program doesn&amp;#039;t know where &lt;code&gt;puts&lt;/code&gt; will be in memory: libc is loaded at a random address each run. So how does &lt;code&gt;call puts&lt;/code&gt; work? Through two small tables, the &lt;strong&gt;PLT&lt;/strong&gt; and the &lt;strong&gt;GOT&lt;/strong&gt;. Understanding them explains a lot of what you see in disassembly listings.&lt;/p&gt;
&lt;h2 id=&quot;the-program&quot;&gt;The program&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;c&quot;&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
int main(void)
{
    puts(&amp;quot;hello&amp;quot;);
    puts(&amp;quot;again&amp;quot;);
    return 0;
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Built with &lt;code&gt;gcc -O1 -no-pie -Wl,-z,lazy hello.c -o hello&lt;/code&gt;. (&lt;code&gt;-no-pie&lt;/code&gt; gives fixed addresses that are easier to follow; &lt;code&gt;-z lazy&lt;/code&gt; asks for lazy binding, which many distributions no longer use by default. More on that below.)&lt;/p&gt;
&lt;h2 id=&quot;main-calls-a-stub-not-puts&quot;&gt;main calls a stub, not puts&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;asm&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;401126:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;sub&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rsp&lt;/span&gt;, &lt;span class=&quot;nu&quot;&gt;0x8&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;40112a:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;lea&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rdi&lt;/span&gt;, [&lt;span class=&quot;rg&quot;&gt;rip&lt;/span&gt;+&lt;span class=&quot;nu&quot;&gt;0xed3&lt;/span&gt;]      &lt;span class=&quot;cm&quot;&gt;; 0x402004: &amp;quot;hello&amp;quot;&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;401131:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;call&lt;/span&gt;   &lt;span class=&quot;nu&quot;&gt;401030&lt;/span&gt; &lt;span class=&quot;nm-l&quot;&gt;&amp;lt;puts@plt&amp;gt;&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;401136:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;lea&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rdi&lt;/span&gt;, [&lt;span class=&quot;rg&quot;&gt;rip&lt;/span&gt;+&lt;span class=&quot;nu&quot;&gt;0xecd&lt;/span&gt;]      &lt;span class=&quot;cm&quot;&gt;; 0x40200a: &amp;quot;again&amp;quot;&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;40113d:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;call&lt;/span&gt;   &lt;span class=&quot;nu&quot;&gt;401030&lt;/span&gt; &lt;span class=&quot;nm-l&quot;&gt;&amp;lt;puts@plt&amp;gt;&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;401142:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;mov&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;eax&lt;/span&gt;, &lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;401147:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;add&lt;/span&gt;    &lt;span class=&quot;rg&quot;&gt;rsp&lt;/span&gt;, &lt;span class=&quot;nu&quot;&gt;0x8&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;40114b:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;ret&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Both calls go to &lt;code&gt;puts@plt&lt;/code&gt; at &lt;code&gt;0x401030&lt;/code&gt;, inside the binary&amp;#039;s own &lt;code&gt;.plt&lt;/code&gt; section.&lt;/p&gt;
&lt;h2 id=&quot;the-plt-stub&quot;&gt;The PLT stub&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;asm&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;401030&lt;/span&gt; &lt;span class=&quot;nm-l&quot;&gt;&amp;lt;puts@plt&amp;gt;&lt;/span&gt;:
&lt;span class=&quot;ad&quot;&gt;401030:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jmp&lt;/span&gt;    &lt;span class=&quot;kw&quot;&gt;QWORD&lt;/span&gt; &lt;span class=&quot;kw&quot;&gt;PTR&lt;/span&gt; [&lt;span class=&quot;rg&quot;&gt;rip&lt;/span&gt;+&lt;span class=&quot;nu&quot;&gt;0x2fca&lt;/span&gt;]   &lt;span class=&quot;cm&quot;&gt;; jump to the address stored at 0x404000&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;401036:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;push&lt;/span&gt;   &lt;span class=&quot;nu&quot;&gt;0x0&lt;/span&gt;                      &lt;span class=&quot;cm&quot;&gt;; relocation index of puts&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;40103b:&lt;/span&gt;  &lt;span class=&quot;mn&quot;&gt;jmp&lt;/span&gt;    &lt;span class=&quot;nu&quot;&gt;401020&lt;/span&gt;                   &lt;span class=&quot;cm&quot;&gt;; common resolver stub (PLT0)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The stub doesn&amp;#039;t jump to &lt;code&gt;puts&lt;/code&gt; directly. It jumps to &lt;strong&gt;whatever address is stored in the GOT slot&lt;/strong&gt; at &lt;code&gt;0x404000&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-got-slot-before-the-first-call&quot;&gt;The GOT slot, before the first call&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;.got.plt&lt;/code&gt; is a table of 8-byte addresses in a writable data segment. Dumping it from the file:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;objdump -s -j .got.plt hello&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;hexdump&quot;&gt;&lt;code&gt;&lt;span class=&quot;ad&quot;&gt;00403fe8&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;08&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;3e&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|.&amp;gt;@.............|&lt;/span&gt;
&lt;span class=&quot;ad&quot;&gt;00403ff8&lt;/span&gt;  &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;nu&quot;&gt;36&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;10&lt;/span&gt; &lt;span class=&quot;nu&quot;&gt;40&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt; &lt;span class=&quot;z&quot;&gt;00&lt;/span&gt;  &lt;span class=&quot;st&quot;&gt;|........6.@.....|&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The slot at &lt;code&gt;0x404000&lt;/code&gt; contains &lt;code&gt;36 10 40 00 …&lt;/code&gt;, little-endian &lt;code&gt;0x401036&lt;/code&gt;: the address of the &lt;code&gt;push 0x0&lt;/code&gt; &lt;strong&gt;inside the stub itself&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The relocation table confirms which symbol that slot belongs to:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;readelf -r hello
  Offset          Type                Sym. Name
  000000404000    R_X86_64_JUMP_SLO   puts@GLIBC_2.2.5&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;lazy-binding-step-by-step&quot;&gt;Lazy binding, step by step&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;First call:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;code&gt;main&lt;/code&gt; calls &lt;code&gt;puts@plt&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;The stub jumps through the GOT slot, which still points to the next instruction in the stub, &lt;code&gt;push 0x0&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;It pushes the relocation index (0 = puts) and jumps to PLT0, which calls the dynamic linker&amp;#039;s resolver (&lt;code&gt;_dl_runtime_resolve&lt;/code&gt;).&lt;/li&gt;&lt;li&gt;The resolver looks up &lt;code&gt;puts&lt;/code&gt; in libc, &lt;strong&gt;writes its real address into the GOT slot&lt;/strong&gt;, and jumps to &lt;code&gt;puts&lt;/code&gt;.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Every later call:&lt;/strong&gt; the stub&amp;#039;s first &lt;code&gt;jmp&lt;/code&gt; now goes straight to &lt;code&gt;puts&lt;/code&gt; in libc. One indirect jump, no resolver.&lt;/p&gt;
&lt;h2 id=&quot;what-modern-binaries-do&quot;&gt;What modern binaries do&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Full RELRO / BIND_NOW&lt;/strong&gt; (&lt;code&gt;-z now&lt;/code&gt;): the dynamic linker resolves every slot at startup and then makes the GOT read-only. No lazy binding; the PLT still exists but the slots are already filled. Many distributions make this the default as a hardening measure.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;code&gt;.plt.sec&lt;/code&gt;&lt;/strong&gt;: with Intel CET enabled you&amp;#039;ll see the stubs split across &lt;code&gt;.plt&lt;/code&gt; and &lt;code&gt;.plt.sec&lt;/code&gt;, with &lt;code&gt;endbr64&lt;/code&gt; instructions. Same idea, different layout.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;code&gt;-fno-plt&lt;/code&gt;&lt;/strong&gt;: the call site does &lt;code&gt;call QWORD PTR [rip+…]&lt;/code&gt; through the GOT directly, skipping the stub.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Check a binary with &lt;code&gt;readelf -d hello | grep -E &amp;#039;BIND_NOW|FLAGS&amp;#039;&lt;/code&gt; and &lt;code&gt;readelf -l hello | grep RELRO&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;why-this-matters-when-reversing&quot;&gt;Why this matters when reversing&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;Tools label stubs as &lt;code&gt;puts@plt&lt;/code&gt; or &lt;code&gt;_puts&lt;/code&gt;, which is why imported function names show up in a stripped binary: they come from the dynamic symbol table, which stripping can&amp;#039;t remove.&lt;/li&gt;&lt;li&gt;A list of imports (&lt;code&gt;readelf --dyn-syms&lt;/code&gt;, or the Imports window in IDA/Ghidra) is a quick summary of what a program can do.&lt;/li&gt;&lt;li&gt;In a debugger, a breakpoint on &lt;code&gt;puts@plt&lt;/code&gt; catches every call, and watching the GOT slot change on the first call is the best way to see all of this happen for real: try &lt;code&gt;gdb ./hello&lt;/code&gt;, &lt;code&gt;break main&lt;/code&gt;, &lt;code&gt;run&lt;/code&gt;, &lt;code&gt;x/gx 0x404000&lt;/code&gt;, &lt;code&gt;next&lt;/code&gt; twice, and &lt;code&gt;x/gx 0x404000&lt;/code&gt; again.&lt;/li&gt;&lt;/ul&gt;</description>
  </item>
  <item>
    <title>What money is: a ledger of promises</title>
    <link>https://ozdc.us/p/what-money-is/</link>
    <guid isPermaLink="true">https://ozdc.us/p/what-money-is/</guid>
    <author>ozdc@ozdc.us (Can Ozdemir)</author>
    <pubDate>Sat, 22 Mar 2025 00:00:00 +0000</pubDate>
    <category>economics</category>
    <category>money</category>
    <category>essay</category>
    <description>&lt;p&gt;This blog is usually about taking binaries apart. This post takes apart something older and more widely used than any file format: &lt;strong&gt;money&lt;/strong&gt;. The method is the same. Ignore the marketing, look at the structure, and ask who can write to it.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;       .--------------------------------------------------.
       |  $  |   THE UNITED LEDGER OF EVERYTHING    |  $  |
       |-----&amp;#039;                                      &amp;#039;-----|
       |    .-------.     PAY TO THE BEARER ON            |
       |   /  .-.  \     DEMAND: ONE (1) UNIT OF          |
       |  |  ( o )  |    &amp;quot;SOMEONE WILL ACCEPT THIS&amp;quot;       |
       |   \  &amp;#039;-&amp;#039;  /                                      |
       |    &amp;#039;-----&amp;#039;      signed: everybody else           |
       |-----.                                      .-----|
       |  $  |   00000001  //  backed by: belief    |  $  |
       &amp;#039;--------------------------------------------------&amp;#039;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;three-jobs-one-tool&quot;&gt;Three jobs, one tool&lt;/h2&gt;
&lt;p&gt;Economics textbooks give money three jobs. They are worth memorising because almost every argument about money is really an argument about which job matters most.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Medium of exchange&lt;/strong&gt;: you can trade it for things without finding someone who wants exactly what you have.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Unit of account&lt;/strong&gt;: prices, debts and salaries are written in it. It is the &amp;quot;type&amp;quot; the whole economy is declared in.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Store of value&lt;/strong&gt;: you can keep it and spend it later.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Anything can try to do these jobs: shells, salt, cigarettes in a prison, gold, paper, numbers in a database. What makes one of them &lt;em&gt;money&lt;/em&gt; is that people expect others to accept it tomorrow. That expectation is the real backing of every money that has ever existed. Gold only adds a second reason to expect it.&lt;/p&gt;
&lt;h2 id=&quot;barter-debt-and-the-order-of-things&quot;&gt;Barter, debt and the order of things&lt;/h2&gt;
&lt;p&gt;The classic story says people bartered, found it awkward, and invented coins. Many anthropologists disagree: they find few societies that ran on barter, and many that ran on &lt;strong&gt;credit&lt;/strong&gt;: &amp;quot;you owe me a goat&amp;quot; written on a tally stick or remembered by the village. In that view coins came later, often to pay soldiers, and money was a record of debt long before it was a lump of metal.&lt;/p&gt;
&lt;p&gt;You do not need to settle that argument to see the useful idea in it: &lt;strong&gt;money behaves like a ledger&lt;/strong&gt;. Every unit is an entry that says &amp;quot;the holder is owed something by the rest of us&amp;quot;.&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   barter                  credit / tally               coins
   ------                  --------------               -----
   [goat] &amp;lt;---&amp;gt; [grain]    |||| |||  &amp;lt;- notched stick   (o) (o) (o)
   needs a double          &amp;quot;you owe me 7&amp;quot;               a debt you can
   coincidence of wants    split in two, each side      hand to a stranger
                           keeps half&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;commodity-money-and-fiat-money&quot;&gt;Commodity money and fiat money&lt;/h2&gt;
&lt;p&gt;For most of recorded history money was tied to a commodity. A coin contained metal, or a paper note promised to exchange for metal on demand. This has one big strength: nobody can create more gold by decree. It also has a big weakness: the supply of money grows only as fast as mining does, not as fast as the economy. When trade grows faster than gold, prices must fall, and falling prices make debts heavier.&lt;/p&gt;
&lt;p&gt;Today almost every currency is &lt;strong&gt;fiat&lt;/strong&gt; money (&amp;quot;let it be done&amp;quot;, from Latin). A euro or a dollar is not a claim on any metal. It is valuable because:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;The state accepts it, and only it, for &lt;strong&gt;taxes&lt;/strong&gt;. Everyone with a tax bill needs some.&lt;/li&gt;&lt;li&gt;Courts treat it as &lt;strong&gt;legal tender&lt;/strong&gt; for settling debts.&lt;/li&gt;&lt;li&gt;A &lt;strong&gt;central bank&lt;/strong&gt; manages how much of it there is, aiming to keep its value fairly stable.&lt;/li&gt;&lt;li&gt;Habit: everyone around you prices things in it.&lt;/li&gt;&lt;/ol&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   +---------------------+
   |   COMMODITY MONEY   |   value  = the metal (+ trust in the mint)
   |   [ Au ]  [ Ag ]    |   supply = mines
   +----------+----------+   risk   = deflation
              |  1971: the last official link to gold is cut
              v
   +---------------------+
   |      FIAT MONEY     |   value  = taxes + law + trusted institutions
   |   [ 01011001 ... ]  |   supply = central bank + commercial banks
   +---------------------+   risk   = inflation, misuse of the printer&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;most-money-is-not-cash&quot;&gt;Most money is not cash&lt;/h2&gt;
&lt;p&gt;If you think of money as banknotes, you are looking at the smallest part of it. Economists count money in layers, roughly:&lt;/p&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;   +------------------------------------------------------------------+
   |  broad money (M2/M3): savings, deposits, money-market funds      |
   |   +----------------------------------------------------------+   |
   |   |  narrow money (M1): cash + current-account deposits      |   |
   |   |   +--------------------------------------------------+   |   |
   |   |   |  base money (M0): cash + bank reserves           |   |   |
   |   |   |   +------------------------------------------+   |   |   |
   |   |   |   |  physical notes and coins                |   |   |   |
   |   |   |   +------------------------------------------+   |   |   |
   |   |   +--------------------------------------------------+   |   |
   |   +----------------------------------------------------------+   |
   +------------------------------------------------------------------+
     the inner box is a small slice; most money is bank deposits&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The exact definitions differ by country, but the shape is the same everywhere: &lt;strong&gt;most money is a number in a bank&amp;#039;s database&lt;/strong&gt;. Who gets to write those numbers is the subject of the next post, &lt;em&gt;How banks create money&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;inflation-the-ledger-gets-diluted&quot;&gt;Inflation: the ledger gets diluted&lt;/h2&gt;
&lt;p&gt;If the amount of money grows much faster than the goods and services it can buy, each unit buys less. That is &lt;strong&gt;inflation&lt;/strong&gt;. A little of it (central banks often target about 2% a year) is seen as harmless or even useful: it nudges people to spend and invest instead of hoarding, and gives room to cut real wages without cutting nominal ones. A lot of it destroys savings and makes planning impossible. Germany in 1923 and Zimbabwe in 2008 are the textbook hyperinflations.&lt;/p&gt;
&lt;p&gt;Inflation is not only about the money printer. Supply shocks matter too: an oil embargo, a war, a pandemic that closes factories. Arguments about any given inflation are usually arguments about how much each cause contributed.&lt;/p&gt;
&lt;h2 id=&quot;who-wins-who-loses&quot;&gt;Who wins, who loses&lt;/h2&gt;
&lt;p&gt;Every way of running money moves wealth between groups, and that is why the topic is political:&lt;/p&gt;
&lt;div class=&quot;tbl-wrap&quot;&gt;&lt;table class=&quot;mdtbl&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;If prices rise faster than expected&lt;/th&gt;&lt;th&gt;If prices fall&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Borrowers win (debts shrink in real terms)&lt;/td&gt;&lt;td&gt;Lenders and savers win&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Savers in cash lose&lt;/td&gt;&lt;td&gt;Borrowers lose, defaults rise&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;People with fixed incomes lose&lt;/td&gt;&lt;td&gt;Businesses delay investment&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;
&lt;p&gt;Schools of thought weigh these trade-offs differently:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Keynesians&lt;/strong&gt; accept active money and fiscal policy to fight unemployment.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Monetarists&lt;/strong&gt; (Milton Friedman) want steady, predictable money growth.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Austrian-school&lt;/strong&gt; economists distrust central banks and prefer hard money such as gold.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Modern Monetary Theory&lt;/strong&gt; argues that a state borrowing in its own currency is limited by inflation, not by running out of money.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Bitcoin advocates&lt;/strong&gt; want a supply fixed by code instead of by people.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Each camp has real evidence on its side and real failures to explain.&lt;/p&gt;
&lt;h2 id=&quot;the-reverse-engineer-s-summary&quot;&gt;The reverse engineer&amp;#039;s summary&lt;/h2&gt;
&lt;pre class=&quot;code&quot; data-lang=&quot;text&quot;&gt;&lt;code&gt;  struct money {
      u64  amount;        // the entry in the ledger
      char issuer[];      // central bank, commercial bank, or a protocol
      u8   trust;         // the only field that cannot be written directly
  };&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Money is a shared ledger of promises. Its value rests on the expectation that others will honour it, backed by taxes, law and institutions. The interesting questions are always: &lt;strong&gt;who can add entries, who audits them, and what happens when people stop believing&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Next: &lt;em&gt;How banks create money&lt;/em&gt;.&lt;/p&gt;</description>
  </item>
</channel>
</rss>
