How so I convert this SHA256 + BASE64 from Swift to PHP?
问题 I've been given this Swift code to try and make work in PHP: finalStr = Encryption.sha256(inputStr) ... class Encryption { static func sha256(_ data: Data) -> Data? { guard let res = NSMutableData(length: Int(CC_SHA256_DIGEST_LENGTH)) else { return nil } CC_SHA256((data as NSData).bytes, CC_LONG(data.count), res.mutableBytes.assumingMemoryBound(to: UInt8.self)) return res as Data } static func sha256(_ str: String) -> String? { guard let data = str.data(using: String.Encoding.utf8), let