исходная функция
Код: Выделить всё
public static func getMD5FromFile(_ file: [UInt8]) -> [UInt8] {
var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
let data = Data(bytes: file, count: file.count)
do {
_ = try data.withUnsafeBytes { p in
CC_MD5(p, UInt32(data.count), &digest)
}
} catch {
print(error)
}
return digest
}
Код: Выделить всё
public static func getMD5FromFile(_ file: [UInt8]) -> [UInt8] {
var digest = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
let data = Data(bytes: file, count: file.count)
do {
let newData = try data.withUnsafeBytes { p in
return p
}
CC_MD5(newData, UInt32(data.count), &digest) // line that gives Cannot convert... warning
} catch {
print(error)
}
return digest
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... ument-type