import CommonCrypto import Foundation /// Checks a firmware image before it is sent to the pump. enum Checksum { static func digest(_ data: Data) -> [UInt8] { var out = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH)) data.withUnsafeBytes { _ = CC_SHA1($0.baseAddress, CC_LONG(data.count), &out) } return out } }