# AP52.2 / Single-Image URL Cypher

`Turing Cypher / True Turing Code` experimental build.

This version is deliberately URL-specific. It does **not** try to carry arbitrary UTF-8 long text. The goal is to fit a URL such as:

```txt
https://masato-lab.pages.dev/portfolio/multiverse
```

into one organic Gray-Scott / reaction-diffusion image.

## Policy

- Visual appearance first.
- No tiles, no QR, no visible grid, no cell carrier.
- No metadata payload.
- No LSB payload.
- No alpha payload.
- No overlay or post-render text/data embedding.
- The encrypted packet enters the generation conditions.
- PASS only means:
  - recovered URL exactly matches the target URL
  - verifier OK
- Verifier OK with a different URL is FAIL.
- Partial text recovery is FAIL.

## What AP52.2 changes

AP52 split the encrypted packet into 16-character chunks and produced too many pages for short URLs.

AP52.2 compresses the URL first:

- dictionary prefix: `https://masato-lab.pages.dev/`
- dictionary path class: `portfolio`
- compact 5-bit slug charset
- fixed 128-bit encrypted packet
- 24-bit keyed verifier

For the target URL, the slug is only:

```txt
multiverse
```

So it fits into one 128-bit encrypted image packet.

## Run

From PowerShell:

```powershell
cd "$env:USERPROFILE\Desktop\ap52_2_single_image_url_cypher"
python -m venv .venv
.\.venv\Scripts\activate
pip install numpy pillow
python run_ap52_2_single_image_url_cypher.py
```

It should create:

```txt
ap52_2_single_image_url.png
```

and print `status : PASS` in the self-decode section.

## Decode an existing generated PNG

```powershell
python run_ap52_2_single_image_url_cypher.py --decode ap52_2_single_image_url.png --expected "https://masato-lab.pages.dev/portfolio/multiverse"
```

## Change URL

Example:

```powershell
python run_ap52_2_single_image_url_cypher.py --url "https://masato-lab.pages.dev/tools" --out ap52_2_tools.png
```

AP52.2 single-image mode supports only the compact URL dictionary and compact slug charset. If a URL is outside this compact form, the script stops and tells you to use the multipage / long-carrier fallback path instead of pretending it succeeded.

## Notes

The reader uses a weak-score beam reranker, but the reranker is not the success condition. It only proposes encrypted bit candidates. The final decision is always exact URL recovery plus keyed verifier OK.

## Cloudflare Pages deploy

This deploy package includes `index.html`, so the project root will not return 404.

```powershell
cd "$env:USERPROFILE\Desktop\ap52_2_single_image_url_cypher_deploy"
npx wrangler pages deploy . --project-name ap52-2-single-image-url-cypher
```

Open:

```txt
https://ap52-2-single-image-url-cypher.pages.dev/
```
