"""Deterministic proof-of-work demonstration using the existing 64-bit control. Not custom RedTail cryptography or a physical entropy source. Candidate bytes: 8-byte big-endian message length || message || 8-byte nonce. Hash: SHAKE256(b'RedTail64-reference-v1\0' || zero_interleave(candidate), 8 bytes). """ from pathlib import Path import hashlib import json import time def expanded_byte(byte): word = 0 for bit in range(7, -1, -1): word = (word << 2) | ((byte >> bit) & 1) return word.to_bytes(2, 'big') TABLE = tuple(expanded_byte(i) for i in range(256)) def expand(data): return b''.join(TABLE[b] for b in data) def candidate(message, nonce): return len(message).to_bytes(8, 'big') + message + nonce.to_bytes(8, 'big') def digest(message, nonce): return hashlib.shake_256( b'RedTail64-reference-v1\0' + expand(candidate(message, nonce)) ).digest(8) def main(): message = b'Hello World' difficulties = (8, 12, 16) first_hits = {} start = time.perf_counter() limit = 2_000_000 # Shared ascending scan: first qualifying nonce for each target. prefix = hashlib.shake_256( b'RedTail64-reference-v1\0' + expand(len(message).to_bytes(8,'big') + message)) for nonce in range(limit): state = prefix.copy() state.update(expand(nonce.to_bytes(8, 'big'))) raw = state.digest(8) value = int.from_bytes(raw, 'big') for bits in difficulties: if bits not in first_hits and value < 1 << (64-bits): assert digest(message, nonce) == raw first_hits[bits] = dict(zero_bits=bits, nonce=nonce, attempts=nonce+1, digest_hex=raw.hex(), ideal_expected_attempts=2**bits, verification_passed=True) if len(first_hits) == len(difficulties): break result = dict(message=message.decode(), algorithm='SHAKE256 reference with zero interleaving', candidate_format='u64be(original message byte length) || message || u64be(nonce)', output_bits=64, nonce_search='Ascending from zero, shared across targets', maximum_attempts=limit, total_attempts=nonce+1, elapsed_seconds=time.perf_counter()-start, results=[first_hits[b] for b in difficulties if b in first_hits], missing_targets=[b for b in difficulties if b not in first_hits], interpretation='One deterministic example, not a statistical validation or security proof') Path(__file__).with_name('hash-target-results.json').write_text(json.dumps(result,indent=2)+'\n') print(json.dumps(result,indent=2)) if __name__ == '__main__': main()