Tobi
04/17/2019, 8:23 AMSIGABRT
when running it from xcode.
Could anyone give me a hand on this?
Thanks in advance.olonho
04/17/2019, 8:34 AMByteArray
to CValuesRef<ByteVar>
doesn’t make sense, please use approach with pinned dataTobi
04/17/2019, 1:51 PMactual object Hmac256Encoder {
@ExperimentalUnsignedTypes
actual fun encode(key: ByteArray, value: String): ByteArray {
val input = value.toUtf8()
val digest = UByteArray(CC_SHA256_DIGEST_LENGTH)
key.usePinned { keyPinned ->
input.usePinned { inputPinned ->
digest.usePinned { digestPinned ->
CCHmac(kCCHmacAlgSHA256, keyPinned.addressOf(0), key.size.convert(), inputPinned.addressOf(0), input.size.convert(), digestPinned.addressOf(0))
}
}
}
return digest.toByteArray()
}
}
markturnip
11/14/2024, 1:39 AM