且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

任何可可源代码的AES加密解密?

更新时间:2023-02-17 18:47:22

AES128加密在iPhone上的CommonCrypto框架中提供。相关函数在CommonCryptor.h头文件中。

AES128 encryption is available on the iPhone in the CommonCrypto framework. The relevant functions are in the CommonCryptor.h header.

您可以创建如下的cryptor:

You can create a cryptor like so:

// Assume key and keylength exist
CCCryptorRef cryptor;
if(kCCSuccess != CCCryptorCreate(kCCEncrypt, kCCAlgorithmAES128, 0, key, keyLength, NULL, &cryptor))
  ; //handle error

// Repeatedly call CCCryptorUpdate to encrypt the data

CCCryptorRelease(cryptor);

似乎从问题和链接,你正在寻找AES的示例实现。我不推荐这个 - 使用苹果的实现!

It seems from the question and the link that you are looking for example implementations of AES. I would not recommend this- use Apple's implementation!

它看起来像 http://pastie.org/297563.txt 也可能会帮助你,但我还没有测试过。

It looks like http://pastie.org/297563.txt might help you also, but I haven't tested it.