问题描述
我希望在iOS 4及更高版本的iOS应用程序中使用MD5或SHA-1。我使用CommonCrypto / CommonDigest.h中的CC_MD5()和CC_SHA1()函数。它似乎在运行iOS 4.1和iPhone 4.0模拟器的iPhone上运行良好,但我很担心,因为XCode 4.2附带的iOS 5 SDK中的函数声明如下:
I am looking to make use of MD5 or SHA-1 in my iOS application targeted at iOS 4 and later. I use the CC_MD5() and CC_SHA1() functions from CommonCrypto/CommonDigest.h. It seems to work fine on an iPhone running iOS 4.1 and in the iPhone 4.0 simulator, but I am concerned because the functions are declared as follows in the iOS 5 SDK that comes with XCode 4.2:
extern unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md)
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0);
extern unsigned char *CC_SHA1(const void *data, CC_LONG len, unsigned char *md)
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_5_0);
这似乎表明这些功能仅适用于iOS 5及更高版本。
This seems to indicate that the functions are only available with iOS 5 and later.
这些功能是否允许在iOS 4应用程序中使用,如果有,是否有任何官方参考文件记录该事实?
Are these functions allowed in an iOS 4 application, and if so, is there any official reference to document that fact?
推荐答案
在路径头文件中: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr /include/CommonCrypto/CommonDigest.h
我们可以看到:
extern unsigned char *CC_MD5(const void *data, CC_LONG len, unsigned char *md)
__OSX_AVAILABLE_STARTING(__MAC_10_4, __IPHONE_2_0);
因此,Apple现在告诉我们它支持: - )
So, Apple now tell us it is supported :-)
这篇关于iOS 4中是否提供CC_MD5()和CC_SHA1()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!