copyjumpvm

History

2026-08-30 — MD5 in copyjump (single-block, run via the Python runner)

Full MD5 computed entirely from copy+jump primitives, executed by the “pythonic runner” vm_programs/CopyJumpMachine.py.

What was built

File Role
vm_programs/md5_gen.py generator: emits program_md5.prg.txt
vm_programs/program_md5.prg.txt generated MD5 program (375,758 lines)
vm_programs/md5_reference.py expected digests via hashlib
vm_programs/md5_check.py runs the program in the VM and diffs vs hashlib
vm_programs/md5.md design notes (memory layout, primitives, round structure)

How it works

Every MD5 operation is lowered to bit-level copy+jump code:

The standard MD5 structure is followed: per round compute F/G/H/I(B,C,D), then F += A + K[i] + M[g], B += leftrotate(F, s[i]), rotate registers A=D, D=C, C=B, and finally add the initial constants back (a0 += A, b0 += B, c0 += C, d0 += D). Bits are LSB-first throughout.

Verification

python3 vm_programs/md5_check.py → PASS against hashlib:

Also verified through the CLI entry point (python3 vm_programs/CopyJumpMachine.py vm_programs/program_md5.prg.txt), which emits the 16 digest bytes LSB-first.

Usage / play

python3 vm_programs/md5_reference.py          # expected digests
python3 vm_programs/md5_gen.py                # (re)generate the program
python3 vm_programs/md5_check.py              # run in VM + diff vs hashlib
python3 vm_programs/CopyJumpMachine.py vm_programs/program_md5.prg.txt

Change the embedded message by editing MESSAGE at the top of md5_gen.py, then re-running the generator.

Scope / notes


2026-08-27 — xorshift32: 5-stage build (XOR gate → PRNG)

All five stages are complete and verified.

What was built (all textual, run via CopyJumpMachine.py — no export)

Stage File Result
1. XOR gate vm_programs/program_xor_gate.prg.txt ✅ 4/4 truth-table cases pass
2. Reference xorshift32 vm_programs/xorshift32_reference.py ✅ outputs match expected
3. Countdown loop-count vm_programs/program_countdown.prg.txt ✅ counts 10 → 1, terminates
4. One number from seed vm_programs/program_xorshift32_step.prg.txt ✅ 0x87985AA5
5. N numbers in loop vm_programs/program_xorshift32_loop.prg.txt ✅ all 10 match reference

Plus the generator: vm_programs/xorshift32_gen.py (emits stages 4 & 5).

Verification highlights

How to use / play with it

# XOR gate (type/pass two bits)
printf '1\n0\n' | python3 vm_programs/CopyJumpMachine.py vm_programs/program_xor_gate.prg.txt

# Reference PRNG (play with seed/n)
python3 vm_programs/xorshift32_reference.py 0x12345678 10
python3 vm_programs/xorshift32_reference.py 1 5

# Countdown
python3 vm_programs/CopyJumpMachine.py vm_programs/program_countdown.prg.txt

# One number / N numbers
python3 vm_programs/CopyJumpMachine.py vm_programs/program_xorshift32_step.prg.txt
python3 vm_programs/CopyJumpMachine.py vm_programs/program_xorshift32_loop.prg.txt

Changing the embedded constants (as requested, documented in comments)

Design notes

Everything is non-interactive (no in reads) so it’s deterministic and directly diffable against the Python reference.

Files created

Possible next steps