目标c中十六进制字符串的校验和 [英] checksum of a hex string in objective c
本文介绍了目标c中十六进制字符串的校验和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
数据样本为:
de 55 7a ff 41 4e 3b
.. .. .. .. .. .. .. .. .. .. .
。
前六个数字(十六进制)的总和为 33b
,校验和数字为 3b
,作为总和的最后2个字符。
the sum of the first six numbers (in hex) is 33b
and the "checksum" number is 3b
, as the last 2 characters of the sum.
此校验和的名称是什么?
What's the name of this check sum?
我如何在目标C中实现它?
How can i make it in Objective C?
谢谢
推荐答案
我找到了解决方案
首先,我必须将十六进制转换为NSData。
之后,将NSData转换为NSMutableArray。
使用NSMutableArray,我可以计算六个数字的总和。
Firstly, i must convert hex to NSData. After that, convert NSData to NSMutableArray. With NSMutableArray i can calculate the sum of six number.
这篇关于目标c中十六进制字符串的校验和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文