Skip to content

Instantly share code, notes, and snippets.

@frozenpandaman
Created April 20, 2026 05:30
Show Gist options
  • Select an option

  • Save frozenpandaman/8ded4c1227154972b31f89d207213acd to your computer and use it in GitHub Desktop.

Select an option

Save frozenpandaman/8ded4c1227154972b31f89d207213acd to your computer and use it in GitHub Desktop.
how to parse FeliCa IC card sector 8f10 (service #66) - "CJRC ticket gate history"
example record:
2000a916100434940850160300000000
-- ==== --------============
io xxxx YYMDHHMMfare
- io: gate info
a0: tapped in
c0: tapped in w/ commuter pass
20: tapped out
40: tapped out w/ commuter pass
00: record cleared at staffed gate (or never been tapped)
= xxxx: system/line/station code (no region info)
see columns 2-3 of https://github.com/soltia48/suica-viewer/blob/main/suica_viewer/station_codes.csv
mirrors @ https://files.catbox.moe/ak903c.csv & https://archive.md/TePxX & wayback machine
e.g. a916 = meitetsu, mikawa line, toyotashi station
- YYMD: date
convert to binary & parse 7-bit year, 4-bit month, 5-bit day
e.g. 3494 = 0011 0100 1001 0100 -> 0011010 = 26, 0100 = 4, 10100 = 20 -> 2026-04-20
- HHMM: time
as-is
e.g. 0850 = 8:50 a.m.
= fare:
reverse order (little to big endian) and convert to decimal
e.g. 160300000000 -> 000000000316 -> 790 yen
(all 0s if staffed gate was involved during entry or exit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment