BitMask

BitMask allows more complex bitwise facility code and card number decoding.

Note: The BitMask and DigitMask options cannot be used together for a given card type. (If both are accidentally specified then only the DigitMask option will be used).

BitMask=-----pffffffffffffffcccccccccccccccccccp--------

ByteOrder=0

BitOrder=0

The BitMask value is applied bitwise to the binary data read from the card. Only f (facility code) and c(card number) characters in the BitMask have any meaning. Any other characters indicate that the corresponding bit is to be ignored.

Without an OutputFormat option, the bytes read from the card are first converted into a 64 bit integer value.

The ByteOrder option determines whether the first or last byte should be considered the most significant:

ByteOrder=0 means the first byte is the most significant.

ByteOrder=1 means the first byte is the least significant.

The BitOrder value may then be used to reverse the order of the bits in the resulting facility code and card number:

BitOrder=0 means that the leftmost character of the BitMask is matched to the most significant bit of the data.

BitOrder=1 means that the rightmost character of the BitMask is applied to the least significant bit of the data and that the bit order is reversed. (That is, the least significant bit is treated as the most significant in the resulting facility code and card number).

Note: Take care if setting both BitOrder and MaskAlignment at the same time, as both parameters reverse the alignment of the mask with the data. If BitOrder=1 and MaskAlignment=1 the alignment will be reversed twice, leaving the data and mask with the default left alignment.

So, for example, reading 6 bytes of data:

BytesToRead=6

The data read from the card is: C6 8B 06 92 48 14

ByteOrder=1

Reverses the byte order giving a 64 bit hex value of: 144892068BC6

In binary this is:

0001 0100 0100 1000 1001 0010 0000 0110 1000 1011 1100 0110

Matching this binary value to a BitMask and BitOrder then works as follows: