How PIN block Encoding works
The most common scenario is ISO-0 PIN Block Encoding.
The block calculation begins with setting up the two parts, Block1 and Block2
PIN block part one is built from character "0", followed by the length of the PIN, then the PIN number, and then fill the value up to 16 characters with "F".
In our example, 0+4+1111+FFFFFFFFFF=041111FFFFFFFFFF
PIN block part two is built from four zeroes, followed by the card number, without the first 3 digits, and without the last digit. So 12 digits.
In our example, for PAN 5516422217375116, the block will be 0000 642221737511
Next step is to do a HEX XOR on the two blocks
XOR(block1, block2)
And then, finally, apply a 3DES encryption of the above block with the PIN Encryption key.