游諭 Swift Dev 🦄

iOS 13 針對加密的framework:CryptoKit

以往要使用加密的函式時,需要接觸 C api,依照 StackOverflow 上的解答,可以使用 CC_MD5

在 C 語言 需 #include <openssl/md4.h>

StackOverflow link :https://stackoverflow.com/a/32166735/10172299

iOS 的 CryptoKit

import CryptoKit

var md5 = Insecure.MD5()

md5.update(data: "1234567890".data(using: .utf8)!)

let digest: Insecure.MD5.Digest = md5.finalize()

print(digest)
// MD5 digest: e807f1fcf82d132f9bb018ca6738a19f

詳細的 WWDC

WWDC 2019 - session 709 - Cryptography and Your Apps: https://developer.apple.com/videos/play/wwdc2019/709/

Tagged with: