如何移动 NSString 的字节?
我有一个像@“123456”这样的NSString。我想将此字符串转换为字节数组,然后我想使用一些算术运算来移动一些字节。然后我想对其应用 SHA256Hash,最后想使用最终结果加密字符串。我尝试了很多方法但仍然没有成功。我对此感到非常困惑。如果有人想查看代码,我会发布代码。
编辑:
我的实际目标是使用 AES256 加密算法加密字符串。我想生成我自己的密钥,我想通过我自己的 IV。
I have a NSString like @"123456". I want to convert this string into byte array and then I want to shift some bytes using some arithmetic operations. Then I want to apply SHA256Hash on that and finally want to encrypt a string using the final result. I have tried many approaches but still got no success. I am very confused in this.If someone wants to look at code i'll post the code.
Edit:
My actual goal is to encrypt an string using AES256 encryption algorithm. And I want to generate my own key and I want to pass my own IV.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您正在尝试实现某种安全性。另一方面,您似乎不太熟悉您正在使用的工具和方法。这是一个糟糕的开始。
即使对于经验丰富的开发人员来说,安全性也是一件非常困难的事情。也许有一种方法可以重用一些现有的实现来满足您的安全需求。
我的建议是不要重新发明事物,尤其是当它们与安全性一样困难且重要时。
I assume you're trying achieve some kind of security. On the other hand it does not look like you're very familiar with the tools and methods you're using. This is a bad start.
Security is a very difficult thing to do—even for experienced developers. Maybe there's a way to reuse some existing implementation for your security needs.
My advice would be not to reinvent things, especially when they are as hard and as crucial as security.