You know you can just call the function directly, right? (Stupid warnings about MD5 being insecure aside…)
Re:Swift System Is Now Open Source
by ChrisMarshallNY on Friday September 25, 2020 @09:06PM
(#24595584)
Didn’t want to import CC.
This is one of a couple of computed CC functions in a very general-purpose StringProtocol extension. I wanted to reduce as many external requirements as possible. I don’t even like importing Foundation, if I can help it.
import Foundation
import CryptoKit
extension String { var md5: String { let computed = Insecure.MD5.hash(data: self.data(using: .utf8)!) return computed.map { String(format: "%02hhx", $0) }.joined() } }
[0] https://github.com/RiftValleySoftware/RVS_Generic_Swift_Tool...