Updated on 2026-08-14

This commit is contained in:
Tangem 2020-06-22 14:27:23 +03:00
parent c55736dbd4
commit 4e37c808c4
3 changed files with 3 additions and 3 deletions

View file

@ -12,7 +12,7 @@ import kotlin.experimental.xor
* Extension functions for [ByteArray].
*/
fun ByteArray.toHexString(): String = joinToString("") { "%02x".format(it) }
fun ByteArray.toHexString(): String = joinToString("") { "%02X".format(it) }
fun ByteArray.toUtf8(): String = String(this).removeSuffix("\u0000")

View file

@ -9,7 +9,7 @@ class ByteArrayExtensionsTest {
@Test
fun `card Id to Hex String`() {
val hex = "cb22000000027374"
val hex = "CB22000000027374"
val bytes = byteArrayOf(-53, 34, 0, 0, 0, 2, 115, 116)
assertThat(bytes.toHexString())
.matches(hex)

View file

@ -187,6 +187,6 @@ class TlvDecoderTest {
fun `map Hex returns correct value`() {
val cardId: String = tlvMapper.decode(TlvTag.CardId)
assertThat(cardId)
.isEqualTo("cb22000000027374")
.isEqualTo("CB22000000027374")
}
}