All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.lightspark.sdk.crypto.internal.Utils.kt Maven / Gradle / Ivy

There is a newer version: 0.6.0
Show newest version
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