Arduino RFID校验和计算和关键可视化 [英] Arduino RFID checksum calculation and key visualization

查看:26
本文介绍了Arduino RFID校验和计算和关键可视化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这个 RFID Arduino 以太网 R3 模块,我需要从软件序列号中检索卡(TAG) 写在标签外的 ID.该模块的 datasheet 说 14 个字节被发送到 Arduino.第一个是页眉,最后一个是页脚,页脚前2个字节是校验和,另外10个字节是包含标签ID的ASCII数据.

I'm using this RFID module for Arduino Ethernet R3 and I need to retrieve from the Software Serial the card (TAG) ID that is written outside the tag. The module's datasheet says that 14 bytes are sent to the Arduino. The first is the header, the last the footer, the 2 bytes before the footer are the checksum, and the other 10 bytes are the ASCII data that contains the tag ID.

如何重新创建卡的ID,并控制校验和?例如,对于 ID 为 0013530444 的标签,Arduino 响应为:

How can I recreate the ID of the card, and control the checksum? For example with a tag that has this ID: 0013530444, the Arduino response is:

I received: 2
I received: 51
I received: 67
I received: 48
I received: 48
I received: 67
I received: 69
I received: 55
I received: 53
I received: 52
I received: 67
I received: 67
I received: 66
I received: 3

但我不知道如何在屏幕上打印 Arduino 读取的 ID.如何计算校验和?

But I've no idea how to print on the screen the ID read by the Arduino. How to calculate the checksum?

http://www.seeedstudio.com/wiki/index.php?title=125Khz_RFID_module_-_UART

有人可以帮我吗?

推荐答案

这是如何计算校验和的演练.

Here's a walkthrough of how to calculate the checksum.

拿你的卡号(这只是直接从你的文字中引用的)

Take your card number (this is just directly quoted from your text)

I received: 2
I received: 51
I received: 67
I received: 48
I received: 48
I received: 67
I received: 69
I received: 55
I received: 53
I received: 52
I received: 67
I received: 67
I received: 66
I received: 3

这会给你一个等价于以下的数字:

This would give you a number that is equivalent to the following:

2 51 67 48 48 67 69 55 53 52 67 67 66 3

2 51 67 48 48 67 69 55 53 52 67 67 66 3

第一个数字 (2) 表示这是请求的开始.

The first numer (2) indicates that this is the beginning of a request.

最后一个数字 (3) 表示这是请求的结束.

The last number (3) indicates that this is the end of a request.

2 51 67 48 48 67 69 55 53 52 67 67 66 3

2 51 67 48 48 67 69 55 53 52 67 67 66 3

为了计算校验和,我们将删除这两个数字.所以你的新号码现在是:

For the purposes of calculating the checksum, we are going to remove these two numbers. So your new number is now:

51 67 48 48 67 69 55 53 52 67 67 66

51 67 48 48 67 69 55 53 52 67 67 66

您拥有的最后两个数字是您的校验和.剩下的数字就是你的卡号.所以:

The last two numbers that you have are your checksum. The remaining numbers are your card number. So:

您的卡号是:

51 67 48 48 67 69 55 53 52 67

51 67 48 48 67 69 55 53 52 67

你的校验和是:

67 66

接下来您需要将您的卡号和校验和转换为 ASCII 值:

Next you need to convert your Card Number and your Checksum to ASCII values:

您的卡号是:

3 C 0 0 C E 7 5 4 C

3 C 0 0 C E 7 5 4 C

你的校验和是:

C B

接下来,将每个数字分成对:

Next, grab each number into pairs:

您的卡号是:

3C 00 CE 75 4C

3C 00 CE 75 4C

你的校验和是:

CB

然后您需要将每一对视为一个 HEXIDECIMAL 值并对它们进行 XOR.所以基本上你需要证明以下几点:

Then you need to treat each pair as a HEXIDECIMAL value and do an XOR against them. So basically you need to prove the following:

3C ^ 00 ^ CE ^ 75 ^ 4C == CB

3C ^ 00 ^ CE ^ 75 ^ 4C == CB

(3C ^ 00) = 3C

(3C ^ 00) = 3C

3C ^ CE ^ 75 ^ 4C == CB

3C ^ CE ^ 75 ^ 4C == CB

(3C ^ CE) = F2

(3C ^ CE) = F2

F2 ^ 75 ^ 4C == CB

F2 ^ 75 ^ 4C == CB

(3C ^ CE) = 87

(3C ^ CE) = 87

87 ^ 4C == CB

87 ^ 4C == CB

(87 ^ 4C) = CB

(87 ^ 4C) = CB

CB == CB

因为 CB == CB,这是一个有效的交易.

Because CB == CB, this is a valid transaction.

毫无疑问,其他人可以想出比这更好的方法,但是这里应该有足够的伪代码供您自己编写.

No doubt someone else can come up with a better approach than this, but there should be enough pseudo code here for you to write it yourself.

这篇关于Arduino RFID校验和计算和关键可视化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆