I have the following code in Swift:
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
}
I'm unsure how to translate CC_SHA256_DIGEST_LENGTH
and CC_SHA256
when doing Android development in Kotlin.
What is the proper way to do this?