Skip to content

Instantly share code, notes, and snippets.

View HarryR's full-sized avatar
🏴‍☠️
My time travel machine is stuck at 60 seconds per minute

HaRoLd HarryR

🏴‍☠️
My time travel machine is stuck at 60 seconds per minute
View GitHub Profile
@HarryR
HarryR / nt365boot.log
Created April 22, 2026 01:18
MicroNT 3.65 boot log (into Lua tools)
BdsDxe: failed to load Boot0001 "UEFI QEMU DVD-ROM QM00003 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Secondary,Master,0x0): Not Found
BdsDxe: loading Boot0002 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)
BdsDxe: starting Boot0002 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1,0x1)/Ata(Primary,Master,0x0)
boot!efi_main: loader entered; FirmwareVendor=EDK II FirmwareRevision=10000
boot!fs_read: \System32\ntoskrnl.exe -> 0x6023000 (1134080 bytes)
boot!fs_read: \System32\hal.dll -> 0x6156000 (43520 bytes)
boot!fs_read: \System32\Drivers\atdisk.sys -> 0x6017000 (41760 bytes)
boot!fs_read: \System32\Drivers\fastfat.sys -> 0x5FE4000 (201824 bytes)
boot!fs_read: \System32\config\SYSTEM -> 0x5FDC000 (12288 bytes)
boot!fs_read_into: \System32\c_1252.nls -> 66082 bytes
@HarryR
HarryR / pe_fix_ilt.py
Created April 16, 2026 12:35
Patch a PE file to populate a missing Import Lookup Table (ILT) from the Import Address Table (IAT).
#!/usr/bin/env python3
"""
Patch a PE file to populate a missing Import Lookup Table (ILT) from the
Import Address Table (IAT).
Older NT 3.5-era PEs (notably MSVCRT20.DLL) ship with importLookupTable = 0
in the import directory entry, because the on-disk IAT already contains the
hint/name RVAs and the Windows loader overwrites them in place.
Stock wibo (<= 1.1.0) does not handle that case; it reads garbage from the
@HarryR
HarryR / mbx.c
Created April 6, 2026 01:27
Recursively styled C interpreter for Andrew Davison's minBASIC: https://coe.psu.ac.th/ad/minBASIC/
/*
* mbx.c — Minimal BASIC Interpreter
*
* C port of minBASIC/mbx.py
* Uses the call stack as program storage: each recursive parse() call
* defines a Stmt on its stack frame, linked via prev/next pointers.
*
* program ::= { [label] statement }
* statement ::= 'P' (var | string | '!' | '-')
* | 'I' var

On the Verifiability of Supra's dVRF

An analysis of Supra's "decentralized VRF" implementation. The conclusion: under the actual trust model, it fails to provide not just the "d" (decentralized), but also the "V" (verifiable) and "R" (random) properties that define a VRF.


Supra's Claims

From Supra's website:

@HarryR
HarryR / ble_monitor.py
Created January 21, 2026 17:51
Use the Google Identity Key and pairing date to monitor your FMDN device
#!/usr/bin/env python3
"""
BLE Advertisement Monitor for FMDN Device Debugging
Monitors all BLE advertisements and tracks devices broadcasting FMDN/Eddystone
service data. Helps identify what data is being broadcast and timing patterns.
Usage:
python ble_monitor.py [--identity-key KEY] [--pair-date TIMESTAMP] [--mac MAC]
# Bootstrap code that reads zipapp from stdin and executes it (single line for -c)
# Uses chr(10) for newline to avoid shell/JSON escaping issues
# Bootstrap code: reads size + zipapp from stdin, passes remaining stdin to inner script
# Format: <size>\n<zipapp_bytes><optional_cgi_body>
# Args after '--' are passed to the inner script as sys.argv[1:]
# Usage: python -c 'BOOTSTRAP' -- arg1 arg2
BOOTSTRAP_CODE := import sys,os,io,zipfile;NL=chr(10).encode();raw=sys.stdin.buffer.read();nl=raw.find(NL);sz=int(raw[:nl]);zb=raw[nl+1:nl+1+sz];sys.stdin=io.TextIOWrapper(io.BytesIO(raw[nl+1+sz:]));sys.argv=["__main__.py"]+[a for a in sys.argv[1:] if a!="--"];print("Content-Type: application/json"+chr(10)) if "GATEWAY_INTERFACE" in os.environ else None;exec(compile(zipfile.ZipFile(io.BytesIO(zb)).read("__main__.py"),"<zipapp>","exec"),{"__name__":"__main__"})
run: my.zipapp
(echo $$(wc -c < $(TEST_ZIPAPP) | tr -d ' '); cat my.zipapp) | COSMOPOLITAN_INIT_ZIPOS=/proc/self/exe cosmo-python -c $(BOOTSTRAP_CODE) -- args
@HarryR
HarryR / type3-symbolic.py
Created August 29, 2025 14:15
Symbolic type-3 pairing & group operations in SymPy/Sage
# Type-3 Pairing Implementation for Sage/SymPy
# Models G1, G2, GT groups and scalar field Fp with bilinear pairing
from sympy import symbols, simplify, Mod, Integer
from typing import Union, Optional
import random
class ScalarField:
"""Scalar field Fp for exponents/coefficients"""
def __init__(self, value, p: Optional[int] = None):
@HarryR
HarryR / graph3d.py
Created June 18, 2025 03:43
Make a 3d graph from nodes and edges, using igraph and plotly
###############################################################################
import sys
from collections import namedtuple
from dataclasses import dataclass
Node = namedtuple('Node',['name','group'])
GraphEdgesT = set[tuple[str,str]]
GraphNodesT = dict[str,Node]
@HarryR
HarryR / README.md
Created June 17, 2025 00:50
Endomorphism structure of y^2=x^3+3 % 199

Uses Plotly and igraph to render an interactive 3d graph of point operations on a j-invariant 0 elliptic curve defined over p=199 via y^2+x^3+3.

image

from sage.all import random_prime, GF, EllipticCurve, GF, is_prime
import math
ZETA = lambda n,x,p: pow(x, ((p-1)//n), p)
MODSQRT = lambda n, p: pow(n % p, (p + 1) // 4, p)
def cornacchia(d, p):
"""
Standard Cornacchia algorithm for x^2 + d*y^2 = p
"""
assert p % 12 == 7