Important!

Blog moved to https://blog.apdu.fr/

I moved my blog from https://ludovicrousseau.blogspot.com/ to https://blog.apdu.fr/ . Why? I wanted to move away from Blogger (owne...

Monday, March 7, 2016

ATR statistics: T0 - Format byte

Article from the series "ATR statistics"

T0 - Format byte

The ISO 7816-3 specification is not public. So I can't copy/paste part of the text. I will use Wikipedia instead.

From Wikipedia https://en.wikipedia.org/wiki/Answer_to_reset#Format_byte_T0:

Format byte T0

The Format byte T0 encodes in its 4 low-order bits (4th MSbit to 1st LSbit) the number K of historical bytes Ti, in range [0..15].
It also encodes in its 4 high-order bits the presence of at most 4 other interface bytes: TA1 (resp. TB1, TC1, TD1) follow, in that order, if the 5th (resp. 6th, 7th, 8th) bit of T0 is 1.

T0#%
0xFF1607.72 %
0x9F1457.00 %
0x8F1085.21 %
0x6F1014.87 %
0x7F874.20 %
0x6E823.96 %
0x65582.80 %
0x9E512.46 %
0x7D452.17 %
0x67432.08 %
0xEF401.93 %
0x88371.79 %
0x6D311.50 %
0xFD281.35 %
0x3F251.21 %
0xFA251.21 %
0x68241.16 %
0x04231.11 %
0x3B221.06 %
0x85221.06 %
0xF7221.06 %
0xDB211.01 %
0xBE200.97 %
0xBF200.97 %
0x16190.92 %
0x6B190.92 %
0x8C190.92 %
0xDF190.92 %
0xFB190.92 %
0x8A180.87 %
0xF9170.82 %
0x1F160.77 %
0x66160.77 %
0x69160.77 %
0x7E160.77 %
0x89160.77 %
0x78150.72 %
0x95150.72 %
0xFE150.72 %
0x17130.63 %
0x77130.63 %
0x8E130.63 %
0xDD130.63 %
0xF8130.63 %
0x2F120.58 %
0x6A120.58 %
0x6C120.58 %
0x86120.58 %
0x8B120.58 %
0xE9120.58 %
0x7A110.53 %
0x98110.53 %
0x9A100.48 %
0x9D100.48 %
0xBA100.48 %
0x2790.43 %
0x8290.43 %
0x8790.43 %
0xBC90.43 %
0xE690.43 %
0x0680.39 %
0x1980.39 %
0x2A80.39 %
0x7B80.39 %
0x8480.39 %
0xF280.39 %
0xFC80.39 %
0x0F70.34 %
0x2670.34 %
0x3D70.34 %
0x7570.34 %
0x7970.34 %
0xB770.34 %
0xD570.34 %
0xEA70.34 %
0xF570.34 %
0x1560.29 %
0x2360.29 %
0x3C60.29 %
0x7660.29 %
0xA760.29 %
0x0250.24 %
0x2450.24 %
0x8D50.24 %
0xB250.24 %
0xE250.24 %
0xE850.24 %
0xEE50.24 %
0x0540.19 %
0x1840.19 %
0x7C40.19 %
0x9C40.19 %
0xB340.19 %
0xD940.19 %
0xDC40.19 %
0xDE40.19 %
0xE740.19 %
0xF040.19 %
0xF640.19 %
0x0730.14 %
0x1230.14 %
0x1B30.14 %
0x1D30.14 %
0x2930.14 %
0x3730.14 %
0x3E30.14 %
0x5F30.14 %
0x6430.14 %
0x9730.14 %
0x9930.14 %
0x9B30.14 %
0xB930.14 %
0xBB30.14 %
0xBD30.14 %
0xD230.14 %
0xD630.14 %
0xEC30.14 %
0xED30.14 %
0xF430.14 %
0x0A20.10 %
0x3220.10 %
0x3420.10 %
0x5B20.10 %
0x8120.10 %
0x8320.10 %
0x9020.10 %
0x9620.10 %
0xA820.10 %
0xAA20.10 %
0xAC20.10 %
0xB020.10 %
0xB820.10 %
0xD820.10 %
0xDA20.10 %
0xE020.10 %
0xE520.10 %
0xEB20.10 %
0x0010.05 %
0x0910.05 %
0x0E10.05 %
0x1C10.05 %
0x1E10.05 %
0x2810.05 %
0x2D10.05 %
0x5710.05 %
0x5E10.05 %
0x6310.05 %
0x7410.05 %
0x8010.05 %
0x9110.05 %
0x9410.05 %
0xAB10.05 %
0xAD10.05 %
0xD010.05 %
0xE310.05 %
0xF310.05 %


Doing statistics on the complete T0 byte is not really informative.

Interface nibble

format#%
130.14 %
0130.63 %
3150.72 %
2401.93 %
4462.22 %
12723.47 %
6864.15 %
9904.34 %
101075.16 %
111155.55 %
81165.60 %
51286.18 %
71366.56 %
131507.24 %
1421210.23 %
1574335.86 %


Interpretation

In 36% of the ATRs the LSB is equal to 15 (or 1111b in binary) indicating that TA1, TB1, TC1, TD1 are present.

For 10% of ATRs the LSB is equal to 14 (or 1110b in binary) indicating that TB1, TC1, TD1 are present, and TA1 is not present.

For 0.63% of ATRs the LSB is equal to 0 (or 0000b in binary) indicate that TA1, TB1, TC1, TD1 are all absent.

A better way to display the result is to isolate TA1, TB1, TC1, TD1 and count them independently.
interface#%
TA199648.07 %
TB1135565.40 %
TC1138166.65 %
TD151925.05 %


Historic nibble

historic#%
400.00 %
570.34 %
10140.68 %
2522.51 %
0552.65 %
3703.38 %
1773.72 %
13834.01 %
11884.25 %
141004.83 %
722010.62 %
926112.60 %
829314.14 %
1533416.12 %
641820.17 %


The number of historic bytes is not equally distributed between 0 and 15 bytes. I guess that is because the historic bytes are coded using a TLV format so some sizes are more frequent than others.



Update: 22th March 2020

It looks like the data for the Historic nibble are wrong. You can get correct values in the article "ATR statistics: Historical bytes - Historical bytes Ti (optional)".
Sorry for that mistake.