Where can I get CommonCrypto / CommonCrypto file from?
我在导入
我在Cocoapods中找到了
https://github.com/AlanQuatermain/aqtoolkit
所以我已经从上面下载了文件。
但是我收到关于
头文件的名称为
不是
在哪里可以下载并获取SHA256的确切文件
不需要其他文件。 首先,您需要一个桥接头文件,但对于那些最不容易实现此目的的人来说,是将一个Objective-C文件添加到您的项目中,并在创建桥接头文件时接受它。 然后,您可以将整个CommonCrypto(感谢@zaph-请参见注释)导入到桥接头文件中:
1 | #import <CommonCrypto/CommonCrypto.h> |
或组成部分:
1 2 3 4 5 | #import <CommonCrypto/CommonCryptor.h> #import <CommonCrypto/CommonDigest.h> #import <CommonCrypto/CommonHMAC.h> #import <CommonCrypto/CommonKeyDerivation.h> #import <CommonCrypto/CommonSymmetricKeywrap.h> |
您现在可以在Swift中使用CommonCrypto。 有关示例代码,请参见此处。
编辑
在Xcode 10中,在Swift中导入CommonCrypto不再需要桥接头。 您可以简单地使用:
1 | import CommonCrypto |
实际上,您不需要使用CommonCrypto编译任何文件,只需将其导入项目中即可。
或在Swift中使用一些包装器,就像https://github.com/soffes/Crypto
让我们回到CommonCrypto文件,Apple已在https://opensource.apple.com/source/中发布了其源代码。