3

I am new in this field, and working on payment gateway, please tell me what is the difference between packed and unpacked binary data used in iso8583 message...!

Andreas Fester
  • 36,091
  • 7
  • 95
  • 123
Shailesh
  • 657
  • 2
  • 13
  • 27
  • 2
    https://en.wikipedia.org/wiki/ISO_8583#Bitmaps. `The bitmap may be transmitted as 8 bytes of binary data, or as 16 hexadecimal characters 0-9, A-F in the ASCII or EBCDIC character sets.` Please also read [ask] how to ask good questions so that you get good answers. Also, how is this related to `Java`? – Andreas Fester Jun 24 '16 at 10:02
  • Sorry to say but where did i mentioned it is related to java. and i was asking about binary packed and unpacked data ? not the bitmap...! – Shailesh Jun 24 '16 at 10:38
  • 1
    You added the `java` tag – Andreas Fester Jun 24 '16 at 10:58

1 Answers1

2

The schema definition files for ISO8583 are available at http://dfdlschemas.github.io/ISO8583. In ISO8583_1993.xsd it says:

* This DFDL schema provides a DFDL model for ISO8583 1993 binary data 
* where each bitmap in the message is encoded as 8 bytes of binary data
* (8 bits per byte). The bitmaps are said to be 'packed'.

So, the term "packed" refers to the bitmaps, which can be either packed or unpacked.

In en.wikipedia.org/wiki/ISO_8583#Bitmaps, it says

The bitmap may be transmitted as 8 bytes of binary data, or as 16 hexadecimal > characters 0-9, A-F in the ASCII or EBCDIC character sets.

In data structures, packed binary data usually means that more (if not all available) bit combinations are used to encode some values, while unpacked means that some bit combinations remain unused, either to improve readability or to make certain calculations easier (but unpacked data takes more space).

For example, one unsigned byte (8 bits) can encode numbers from 0 to 255. If the numbers are BCD encoded, only numbers from 0 to 99 can be represented, and some bit combinations remain unused. However, it is in some cases easier to base calculations on a BCD encoded number than on a binary encoded number.

In summary, ISO 8583 defines two different encodings:

  • packed which is 8 bytes of binary data
  • unpacked which is 16 bytes as hexadecimal characters (in two different encodings, but that is another aspect).

One obvious difference is, that when you dump this data to a console, you can immediately read the unpacked data as hexadecimal numbers, while the binary encoding will only print some garbage characters, depending on your console, your locale and the font which you have installed.

Andreas Fester
  • 36,091
  • 7
  • 95
  • 123
  • means whenever the bitmap is in the form of binary it would be of length 8 bytes and if it's in hexadecimal it would of 16 bytes right..? – Shailesh Jun 24 '16 at 12:23
  • That is my understanding according to what the linked article says. – Andreas Fester Jun 24 '16 at 12:57
  • Its not just about bitmaps. I have encountered iso8583 messages where numeric fields are packed as BCD. The only thing i was confused about in some messages LLVAR and LLLVAR length encoded as BCD and in some messages as BINARY.e.g. FOR DE2(PAN of 19 digit) BCD lengh was 0x19, BINARY length 0x13. – krishna T Nov 12 '19 at 07:31