Suppressing deprecated warnings

I just found this thread because I have a specific warning I would like to get rid of:

'CC_MD5' was deprecated in iOS 13.0: This function is cryptographically broken and should not be used in security contexts. Clients should migrate to SHA256 (or stronger).

This shouldn't be a deprecation warning in the first place, because just because MD5 is now considered insecure, it doesn't change the fact that it's still needed in my environments. The fact that Swift won't let me turn of the deprecation warning is a bit upsetting to me, because I feel patronized over something I have no control over.

Probably not the best section to comment on this, but if someone has a pointer where to bring this up, because I feel that the Swift dev's stance on not allowing us to turn off this warning in individual places is a bad idea, at least in this case.

Update: There is a workaround for this MD5 case: Swift should allow for suppression of warnings, especially those that come from Objective-C - #49 by bzamayo
Basically, instead of the outdated MD5 function from CommonCrypto, use the Insecure.MD5.hash (data: …) function from CryptoKit.

2 Likes