Original address: unknown 8583 is like this, let me give a simple example. Take the message of 64 domains as an example. I don’t know what the domain is. You can think of it as a drawer for storing medicine in a hospital. A drawer is pre-defined for what to put, such as Jianweixiaoshi tablets or cold granules. In general, it is best to always put Jianweixiaoshi tablets in the drawer of the definition of Jianweixiaoshi tablets, do not put other things, of course you can also put Banlangen, but this is easy to make mistakes and is not standardized. The quantity is so stipulated, there are three situations: First of all, it is quantitative, which means that if you define the drawer to put 30 bottles of Jianweixiaoshi tablets, you can’t put more than 30 bottles, and no less. The second is LLVAR, that is to say, the quantity is defined by a 1-bit byte. For example, 0x12 means 12 bottles inside. Of course, you can also understand it as 16+2=18 bottles. But if 0x12 means 12, then 0x13 is equal to 13, don’t 0x12=12, 0x13=19 The last is LLLVAR, which is a 2-bit byte indicating the quantity, such as 0x01,0x04 = 104 The domain is like this, there are a total of 64 domains, each domain pre-defined content and length There is a bitmap called BITMAP, which defines a packet containing Several domains. for example 20 00 38 00 00 00 00 34 You untie it and arrange it 20 = 0010 0000 00 = 0000 0000 38 = 0011 1000 And so on, get a string of numbers 0010 0000 0000 0000 0011 1000 0000 0000 0000 0000 0000 0000 0000 0000 0011 0100 Then count from left to right which ones contain 1s. In the above example, we get 3 19 20 21 59 60 62, these digits contain 1. In other words, the following message contains these fields. Well, having said so much, let’s make a simple example such as a consumer transaction, which needs to send transaction type, card number, etc., defined as follows Card number second domain LLVAR BCD 5309987876545342 Transaction type third field length 6 BCD 900000 Amount 4th field length 12 BCD 100 points Time 7th field length 8 BCD 20030802 2磁道信息 第35域 LLVAR ASCII 123456 3磁道信息 第36域 LLLVAR BCD 123456001 商户号 第41域 LLVAR ASCII 98765432 好了我们现在开始打包,首先按照长度和类型把上面的数据处理一下 卡号 165309987876545342 交易类型 900000 金额 000000000100 时间 20030802 2磁道 06313233343536 3磁道 0009123456001 商户号 083938373635343332 接下来我们按照域信息生成位图 因为有第2域,所以第二个位置是1,由第三域,所以第三个位置 是1,。。。 依此类推得到一串数字 0111 0010 0000 0000 0000 0000 0000 0000 0011 0000 1000 0000 0000 0000 0000 0000 转换过来,就是 72 00 00 00 30 80 00 00 这个就是BITMAP了 然后把上面的数据按照BITMAP+每个域的内容,依次排列 就得到这个包的内容了 7200000030800000165309987876545342900000000000000100 20030802063132333435360009123456001083938373635343332 前头再加上TPDU和MSGID就是最后的数据包,解包也一样的。 |
[Turn] Understanding of bitmaps in the 8583 protocol
Guess you like
Origin blog.csdn.net/zhengjian1996/article/details/112918717
Ranking