From fc560d275258edd09e043f52e236e91ee4779dcf Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 25 Mar 2026 13:22:02 -0400 Subject: [PATCH] reuse hex methods. --- .../quartz/nip44Encryption/crypto/ChaCha20CoreTest.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip44Encryption/crypto/ChaCha20CoreTest.kt b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip44Encryption/crypto/ChaCha20CoreTest.kt index a910aa004..276b18610 100644 --- a/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip44Encryption/crypto/ChaCha20CoreTest.kt +++ b/quartz/src/commonTest/kotlin/com/vitorpamplona/quartz/nip44Encryption/crypto/ChaCha20CoreTest.kt @@ -20,6 +20,8 @@ */ package com.vitorpamplona.quartz.nip44Encryption.crypto +import com.vitorpamplona.quartz.nip01Core.core.hexToByteArray +import com.vitorpamplona.quartz.nip01Core.core.toHexKey import kotlin.test.Test import kotlin.test.assertContentEquals import kotlin.test.assertEquals @@ -30,14 +32,9 @@ import kotlin.test.assertFailsWith * and libsodium test suite. */ class ChaCha20CoreTest { - private fun hex(s: String): ByteArray = - s - .replace(" ", "") - .chunked(2) - .map { it.toInt(16).toByte() } - .toByteArray() + private fun hex(s: String): ByteArray = s.replace(" ", "").hexToByteArray() - private fun ByteArray.toHex(): String = joinToString("") { "%02x".format(it) } + private fun ByteArray.toHex(): String = toHexKey() // ===== RFC 8439 ยง2.3.2: ChaCha20 Block Function Test Vector ===== @Test