简体   繁体   English

NSMutableData字节的总和

[英]Sum of NSMutableData bytes

I would like to have a sum of NSMutableData bytes, is this possible with a quick method, or I should implement my own? 我想要一个NSMutableData字节的总和,是否可以通过快速方法实现?还是我应该自己实现?

I have NSMutableData <4b01000F 00000005> and I would like to know sum of all bytes (4b + 01 + 00 + 0F + etc). 我有NSMutableData <4b01000F 00000005> ,我想知道所有字节的总和(4b + 01 + 00 + 0F +等)。

I don't think there's a built-in function. 我认为没有内置功能。 Sounds like you're trying to build some sort of checksum. 听起来您正在尝试建立某种校验和。 You'll have to iterate through the bytes and start adding. 您必须遍历字节并开始添加。

You might find this useful however: https://discussions.apple.com/thread/1509152?threadID=1509152&tstart=96 您可能会发现这很有用: https//discussions.apple.com/thread/1509152?threadID = 1509152&tstart = 96

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM