Go to file
eta 064b18c52a update public key database & rust dependencies
- reapply realloc->undefined hack, otherwise decoding mysteriously fails
  with 'ticket too short'
2024-11-29 20:54:22 +00:00
.idea webshite 2023-01-14 00:41:33 +00:00
pkg update public key database & rust dependencies 2024-11-29 20:54:22 +00:00
rsp6-webshite fix standard class field (thanks Alan Dennis!) 2023-03-02 22:39:22 +00:00
src webshite 2023-01-14 00:41:33 +00:00
.gitignore webshite 2023-01-14 00:41:33 +00:00
Cargo.lock update public key database & rust dependencies 2024-11-29 20:54:22 +00:00
Cargo.toml update public key database & rust dependencies 2024-11-29 20:54:22 +00:00
decode.py first working version 2022-12-29 00:10:21 +00:00
keys.json update public key database & rust dependencies 2024-11-29 20:54:22 +00:00
LICENSE webshite 2023-01-14 00:41:33 +00:00
README.md also docs 2023-03-02 22:56:14 +00:00
rsp6-decoder-rs.iml first working version 2022-12-29 00:10:21 +00:00
spec.ods add spec and README 2023-02-02 19:08:50 +01:00
spec.pdf add spec and README 2023-02-02 19:08:50 +01:00

rsp6-decoder

This is a set of tools to decode UK National Rail electronic ticket barcodes, specifically RSP6 format, as explained in the blog post "Reversing UK mobile rail tickets".

If you're interested in a working demo, check out the hosted version at eta.st/tickets/.

What's in this repo?

  • This repo is primarily a Rust crate that can decode these tickets, given a scanned barcode string (starting with 06...). Look at the decode_ticket function for the main entry point.
  • A website that embeds the crate for demo purposes (powering the hosted version) is inside rsp6-webshite/.
    • This will require compiling the main crate for WASM using wasm-pack build --features wasm.
    • If you get errors decoding at runtime, you might need to replace references to wbindgen_realloc in pkg/rsp6_decoder_bg.js with undefined. It's unclear why this happens.
  • spec.pdf has a janky table showing what all the fields in a decoded ticket look like.
    • spec.ods is the janky spreadsheet that was used to make this.
  • keys.json has a copy of all the ticket public keys, as of 2023-01.
    • decode.py was a hacky Python script to make these from some binary plist I found at some point. You can ignore it.

License

This is all MIT. Please go forth and use it to make your own ticket stuff!

Notes to future eta on how to deploy this

For development:

$ npm run start

Deploying:

$ npm run build -- --mode=production && scp -r dist/* [redacted]:/www/tickets/