commonMain.com.lightspark.sdk.crypto.internal.Utils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lightspark-crypto-jvm Show documentation
Show all versions of lightspark-crypto-jvm Show documentation
The Lightspark shared crypto library.
package com.lightspark.sdk.crypto.internal
internal fun String.hexToByteArray(): ByteArray {
check(length % 2 == 0) { "Must have an even length" }
val byteIterator = chunkedSequence(2)
.map { it.toInt(16).toByte() }
.iterator()
return ByteArray(length / 2) { byteIterator.next() }
}
internal fun List.toByteArray(): ByteArray = toUByteArray().toByteArray()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy