From 421469b2209b0599e9a1db1ea70129581fda8bb6 Mon Sep 17 00:00:00 2001 From: Stacey Sheldon Date: Tue, 1 Jan 2019 01:23:55 -0500 Subject: [PATCH] FASC-N: correct encoding of the packed 4-bit decimal format with odd parity The BCD digits in the FASC-N credential are sent lsb first followed by an odd parity. Since this perl script is simply packing the bits in their expected order, the encodings should exactly match figure 7 in "Technical Implementation Guidance: Smart Card Enabled Physical Access Control Systems Version 2.2". --- tools/fasc.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/fasc.pl b/tools/fasc.pl index 9ba75dd..205b65a 100644 --- a/tools/fasc.pl +++ b/tools/fasc.pl @@ -31,24 +31,24 @@ # S9999F9999F999999F0F1F0000000000300001E # and outputs that in hex, encoded in the 5-bit form described in # "Technical Implementation Guidance: Smart Card Enabled Physical Access -# Control Systems" +# Control Systems Version 2.2", Section 6.2, Figure 7. use strict; use Bit::Vector; my %encoding = ( 0 => "00001", - 1 => "00010", - 2 => "00100", - 3 => "00111", - 4 => "01000", - 5 => "01011", + 1 => "10000", + 2 => "01000", + 3 => "11001", + 4 => "00100", + 5 => "10101", 6 => "01101", - 7 => "01110", - 8 => "10000", + 7 => "11100", + 8 => "00010", 9 => "10011", - S => "11010", # the examples and definitions of S and F differ - F => "10110", # but we'll go with the examples here.. + S => "11010", + F => "10110", E => "11111", );