KDE PIM/KItinerary/ZSSK Barcode: Difference between revisions

From KDE Community Wiki
Line 8: Line 8:
* zlib compressed textual payload starting at offset 3.
* zlib compressed textual payload starting at offset 3.
* zlib decompressed content is plain text and hardly larger than the full compressed data, which suggests the compressed data doesn't span the full length of the barcode (signature?).
* zlib decompressed content is plain text and hardly larger than the full compressed data, which suggests the compressed data doesn't span the full length of the barcode (signature?).
== Binary Structure ==
{| class="wikitable"
! Offset !! Format !! Meaning !! Notes
|-
| 0 || 0x04 || ? || fixed value
|-
| 1-2 || 16 bit BE || ? || varies with length?
|-
| 3-4 || 0x78 0x9C || zlib marker ||
|-
| 5+ || zlib || see below ||
|-
| ? || ? || ? || high entropy data, signature?
|-
| -16 || 0x00 || ? || last 16 bytes are always 0x00
|}


== Textual Payload Structure ==
== Textual Payload Structure ==

Revision as of 19:54, 17 June 2022

Domestic Ticket

General Observation

  • Aztec barcode, in PDF or image
  • Variable length
  • For domestic tickets only, international ones use RCT2 in UIC 918.3 container
  • zlib compressed textual payload starting at offset 3.
  • zlib decompressed content is plain text and hardly larger than the full compressed data, which suggests the compressed data doesn't span the full length of the barcode (signature?).

Binary Structure

Offset Format Meaning Notes
0 0x04 ? fixed value
1-2 16 bit BE ? varies with length?
3-4 0x78 0x9C zlib marker
5+ zlib see below
? ? ? high entropy data, signature?
-16 0x00 ? last 16 bytes are always 0x00

Textual Payload Structure

  • 34 lines, delimited by 0x0A
  • UTF-8 encoded
  • date/time format: 8 digits, the first 4 digits are the days since 2009-01-01, the last four are the time in "hhmm" format. Local time/no timezone.
Index Format Meaning Notes
0 "P" fixed value
1 16 digit number ticket number
2 6-8 digit number ?
3 N.NN ticket price in EUR
4 N.NN price? 0.00 in all samples
5 N.NN price? 0.00 in all samples
6 string departure station name
7 string arrival station name
8 <number>[<digit>.tr.] train number and class ("trieda" is class)
9 date/time departure time
10 date/time end of validity? this is encoded with one day more than printed in the PDF?
11 string passenger name
12 ? ? 0 in all samples
13 ? ? empty in all samples
14 ? ? empty in all samples
15 ? ? empty in all samples
16 ? ? empty in all samples
17 1-3 digit number ?
18 ? ? 0 in all samples
19 date/time ? ?
20 7 digit number discount program membership number
21 7 digit number ? can be empty, possibly related to the discount program?
22 "N" fixed value
23 "text" fixed value
24 string ticket name/title e.g. "CESTOVNÝ LÍSTOK"
25 <string>": "<digit> tariff name? e.g. "OBYČAJNÝ" (ordinary) or "KLASIK RP" (discount program), digit is 1 in all samples
26 string ticket type? e.g. "JEDNOSMERNÁ CESTA" (one way)
27 ? ? empty in all samples
28 "Z: "<string> departure station name
29 "Do: "<string> arrival station name
30 "Km: "<number>" NO-"<string>"-"<digit>".tr." distance?/train type/class train type is e.g. "R" or "REX"
31 "Vlak: "<number> train number
32 ? ? empty in all samples
33 ? ? empty in all samples